As others have noted, you can use `net/http/httptest`. I'm not personally a huge fan of that package, though.
As a result, I wrote an HTTP testing tool to run API tests against my servers. Of course, it can be used to test against any HTTP service, but it does happen to be written in Go. Test cases are straightforward and declarative: you just give it a request to make and the expected response. As a bonus, you can automatically generate documentation of your endpoints from the test cases. (Which is really pretty handy.) https://github.com/instaunit/instaunit On Wednesday, July 19, 2017 at 12:44:01 PM UTC-4, st ov wrote: > > When creating a simple server using http.Server and http.ServeMux, how do > you test it? > > What do you do for unit tests? integration tests? > > Do you mock requests to each handler and check the response? How? > > How do you test peformance and requests per second? > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.