Testing¶
Unit Tests¶
For unit testing, the Open Data Dashboard relies on Jest, a Testing Framework with a focus on simplicity.
This way, it is ensured that isolated units of the application work as expected. The tests can be run from your terminal:
Component Tests¶
For testing individual components,
the Open Data Dashboard utilizes the React Testing Library,
which focuses on testing components in a way that simulates actual user behavior.
This approach ensures that the components not only perform as intended from a technical standpoint but also provide the expected user experience.
The component tests are executed together with the unit tests:
E2E Tests¶
The Open Data Dashboard uses Cypress end-to-end tests to ensure that our application can always meet certain user expectations.
Note
Since our application is dependent on data from other applications, some tests might fail if that data changes. In that case, the tests will need to be adjusted.
Running Cypress Tests on Your Local System¶
In order to execute Cypress tests on your local system, you will first need to have an instance of the application running. To do this, navigate to the application root folder and in your terminal execute either:
or
The "cypress" suffix ensures that we load the correct configuration for the tests, since we do not want to depend on the production configuration for testing.
To execute the tests themselves, there are once again two options: The Cypress app, or the terminal. Executing them in the terminal is very straightforward:
Using the desktop app is a bit more work, but it results in a more holistic experience:
Once the dashboard is up and running, select E2E Testing and a browser of your choice. All of the tests are contained within spec.*.cy.ts files, which can be executed right from the dashboard.
For further information on the Cypress app, see the Cypress documentation