Learn Go Programming
1,998 FOLLOWERS
Wanna learn Go? You’re in the right place! This will be a series of tutorials to teach you Golang! New tutorial every week!
Learn Go Programming
4y ago
How to mock? Go Way.
Go has a built-in testing framework provided by the testing package, that makes writing tests easier, but how do we write a more complicated test that requires mocking?
In this post, we will learn how to take advantage of structs and interfaces in Go to mock any service or library you might be using, without using any 3rd party tools and libraries.
We will start by defining our system to understand what we are going to test and mock.
System
Example System and Integration.Our system has two components.
“Our Service” that we own and build.
“Third-party service or library ..read more