Erlang YAWS: How to test a simple REST web service?

erlang, erlang-otp, eunit, rest, yaws

Solution

Did you try etest and especially etest_http?

Problem

In a simple Erlang YAWS-based RESTful application I would like to have a set of tests that send HTTP requests to a RESTful API, get responses from the server and then test those responses. It would be nice if each "send-request-get-request-test" test could be run from within EUnit (making possible to use test generators). I would also like to be able to run this set of tests with `rebar` (`make test`). Recently I used `ibrowse` in another application (Mochiweb), but I found it quiet cumbersome to use. Are there any other options to write Erlang/OTP tests that can send HTTP requests to a YAWS RESTful application? What is the most common way to do that?

Original source