httptest solves the problem of spinning up a new server for use in tests.
However, there are cases where you already have a server (ie. your golang program) and you want to end-to-end test the whole binary (ie. execute the binary with the given arguments and test it).
httptest is a good fit when you need a mock server in your tests. spawn is a good fit when you want to test your actual server binary.
pasxizeis|7 years ago
However, there are cases where you already have a server (ie. your golang program) and you want to end-to-end test the whole binary (ie. execute the binary with the given arguments and test it).
httptest is a good fit when you need a mock server in your tests. spawn is a good fit when you want to test your actual server binary.