How To: Unit Test Your (HTTP) Handlers in Go

http://elithrar.github.io/article/testing-http-handlers-go/

Prompted by a number of questions in the Go Slack community (and elsewhere!), I’ve written up a short article on how to:

  • Unit test your handlers
  • Create context.Contexts for testing with
  • Stub out database calls in your tests

I hope it’s useful, and happy to take feedback here.

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.