/loopback-example-supertest

This project aims to demonstrate a way to test Loopback applications in a scalable way.

Primary LanguageJavaScript

loopback-example-supertest

This project aims to demonstrate a way to test Loopback applications in a scalable way.

It uses SuperTest to send the requests and test the responses.

Developed with:

How it works ?

Each test suit has a test specific data set at each run. The tests use the memory data source and boot the app with a dedicated data file. Before a test suit is started, it calls TestUtils.start with a name, app and data. It then creates a file under tmp and populates it with the data provided.

This ensures each test can be "clustered" and run separately without impacting each other.

Tests

All the tests are located under test/acceptance.

Watch test

./scripts/watch.sh ./test/acceptance/{{test-file-to-watch}}

Debug test

./scripts/debug.sh ./test/acceptance/{{test-file-to-debug}}

Then in another tab: ./scripts/start-debugger.sh

Notes:

  • The code in test/acceptance/data/ and test/mock-factories is kept bare simple for understandability.
  • Cannot debug and watch in the same time due to port conflict
  • Successful POST requests should return 201