Code Monkey home page Code Monkey logo

simple-golang-unit-testing's Introduction

Simple Golang Unit Testing

Simple Golang Unit Testing

We will learn about implement unit testing in Golang.

Topics :

  • Setting up the Golang Project
  • Defining the Product Entity
  • Connecting to the database
  • Implementing Unit test with 1 feature, it's find data by ID

Our Step :

  • In the first step, we create an entities to represent the structure of our data in the entity package
  • In the second step, we create query a function to handle our query
  • Then register the new function in our model interface
  • In the third step, we create algorithm function to handle all condition in our flow proccess
  • and again, we register it into source contract interface
  • In fourth step is create faker data or mock data
  • than, we create a seederes, to input fake data to database testing
  • And the last step is, we create unit test with 2 case, 1 positive cae and 1 negative case

Notes :

Last but not least, let's start to try to write a function that we think will be used many times in helpers. Happy coding and keep learning ๐Ÿ˜œ

simple-golang-unit-testing's People

Contributors

fajarcandraaa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.