JSON on HTTP API test framework

Hello,

I need to test an HTTP API that consumes json palyload and generates json output. I need to do
unitary tests with basic scenarii like this

  • try to register a user with all parameters set
  • try to register a user with missing mandatory parameters
  • call API with parameters having bad formats

but also with some more higher level scenarii:

1/ create a user
2/ login with that users creds
3/ do some action with that user
4/ logout that user

and eventually, I also need to stress test the API servers with LOTs of such scenarii in parallel with possibly a timing report per API

The APIs are written in PHP on Apache (yes, I know… but it’s not my work :slight_smile: ). I firstly tried K6 (k6.io) but it’s not as crystal clear as I thought and javascript is really a pain in the ass.

I was wondering if there was some framework for this kind of job in elixir

Thanks
Maurycy

1 Like

I don’t know of any, but you can use ExUnit to test the APIs:

  • create a new Elixir project,
  • add an HTTP client (Tesla, HTTPoison, Finch, etc.),
  • write ExUnit tests that make actual HTTP calls to the API,
  • run with mix test.