Table of Contents
How we handle unit testing when function must be connect to database or third party service, that is so complicated case when we have to connect database first etc. How to make it to be more simple ?..let see mocking
What is mock In object-oriented programming, mock objects are simulated objects that mimic the behaviour of real objects in controlled ways, most often as part of a software testing initiative. A programmer typically creates a mock object to test the behaviour of some other object, in much the same way that a car designer uses a crash test dummy to simulate the dynamic behaviour of a human in vehicle impacts. The technique is also applicable in generic programming. wikipedia
In this project we implement simple example of mocking schema using golang unit test.
go test ./...
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/[FEATURE]
) - Commit your Changes (
git commit -m 'Add some [FEATURE]'
) - Push to the Branch (
git push origin feature/[FEATURE]
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.