Unit Testing Your Go Webserver Using Mocks

Pascal Zwikirsch
Level Up Coding
Published in
9 min readJul 8, 2021

--

Using mocks in your unit tests is important. This article should show you how to use mocks in your Go tests making use of dependency injection.

Photo by Ben White on Unsplash

In today's tutorial, I want to show you how to test your Go webserver. In this example, I am using Go Fiber as my webserver framework of choice. But of course, you are completely free to use any other framework you like.

--

--