Testing

Unit tests

We write unit tests and we check code coverage for all the modules. We do not have a hard limit on the % of coverage, however, the unit tests should always cover all the functionalities (methods, functions) of the project. Unit tests are also a part of our contribution guidelines. So far we do not do purely TDD.

Integration tests

For the form of ‘integration testing’, we use Portman for testing our APIs – testing the exposed APIs based on their documentation/specification. We browse all the routes that are defined in the documentation and one after the other they are called on a running server above the tested code. Correct answers are checked (by the example/schema of data from the documentation), format of data, etc.

End-to-end tests

For end-to-end tests we use the Cypress tool, where we simulate user action, we check the behaviour of the application and the correct outputs.

Automatization

We run the tests automatically in our CI/CD tool. After a push to the development or master branch, the application is put together and then unit and integration tests are done. If everything goes through then a new Docker image is created, it is uploaded to the registry and automatically deployed. For applications with API documentation, the current (and at the same time the currently tested) documentation to the API is automatically uploaded in the pipeline. In the case of packages that are available on npmjs.org we also automatically publish the packages in CI.