Integration API tests
The file test/clj/integration/jobtech_taxonomy_api/api_test.clj
contains tests of the API derived mainly from
OpenSearch logs. The tests can run in the following ways:
- Against a local server launched by the fixture.
- Against a mock app launched by the fixture.
- Against a remote sever.
The namespace of that file is tagged with ^:real-server-test
.
That means that it will be detected by the function
utils.api-test-helpers/run-real-server-tests-with-host
.
That function is called with the host address of a real server
to test against, for example
(run-real-server-tests-with-host \"https://taxonomy.api.jobtechdev.se\")
The purpose of the tests in this namespace is:
- To test the correctness of the taxonomy before deployment
- To test the correctness of the taxonomy after deployment
- To have a set of tests to measure the performance.
NOTE: We cannot always be sure exactly which taxonomy that we test. In case we test a remote server, we will assume that the version being run on the remote server is no older than version deployed on any production server at the time when these tests were written. In case some test here breaks when tested against a remote server because the version of the taxonomy deployed on that server is too new, these tests must be updated. But such errors would usually be caught during development since these tests are part of the test suite.
The data used in the tests is stored under test/resources/sample_requests
in a folder hierarchy that reflects the hierarchy of the HTTP paths.
For some of the tests, the response should be expected to be constant
apart from variation in how elements in lists are ordered. But there are
also tests where this may not be true. Those tests are:
- API requests where we limit the result size using some
limit
parameter. Ideally, it would be good if the ordering is the same but there are no such guarantees from the API. - API requests where we don't ask for data from the latest version. When
no
version
parameter is present in the request, the default version is typically thelatest
version.