zio-http icon indicating copy to clipboard operation
zio-http copied to clipboard

Create ZIO HTTP TestKit module to help with testing

Open jdegoes opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe.

The current version of ZIO HTTP does not provide a testkit, which means that users are on their own for testing.

Describe the solution you'd like

Providing TestServer and TestClient implementations of the zio.http.Server and zio.http.ZClient interfaces. These test versions would operate similar to the test implementations of Console, System, etc., in ZIO core: they would record interactions, and make those interactions accessible; and they would allow feeding responses, errors, or other issues to test the code in question.

Describe alternatives you've considered

None.

jdegoes avatar Sep 19 '22 20:09 jdegoes

@swoogles Thank you! 🙏

jdegoes avatar Sep 20 '22 17:09 jdegoes

I think it makes sense to have a test client however I am not sure if there is any value in adding a test server. The server is typically implemented using Http which is a ZIO function. One can simply call the function and run the http app directly in the test.

tusharmath avatar Oct 27 '22 18:10 tusharmath

Seems to be done now

vigoo avatar Jan 21 '23 13:01 vigoo