Skip to content

[v2] Development: Testing

Matteo Gregoricchio edited this page Apr 23, 2024 · 1 revision

.NET - Backend

The test projects are located inside the tests/* folder.

Each Serilog.Ui project has a separate test project. Each project is based onto the xUnit test framework.

Serilog.Ui.Common.Tests: shared test kit.

To run the tests, use Test Explorer in Visual Studio or run from the root folder:

dotnet test

Please notice: to run the tests, you'll need a running Docker instance on your sistem!

Integration tests (identified by traits naming) use Docker to spin the integration database for the following providers:

  • MsSqlServerProvider
  • MySqlProvider
  • PostgreSqlProvider

JS - Frontend

Tests are located inside src/Serilog.Ui.Web/assets/tests

Tests are based onto Jest test framework, with the help of JSDOM and testing-library packages.

Any HTTP request is mocked through msw.

Jest configuration can be found in src/Serilog.Ui.Web/jest.config.js.

Any additional setup item is located inside src/Serilog.Ui.Web/assets/tests/util (this folder is excluded from test runs or analysis).

To run the tests, open a terminal in src/Serilog.Ui.Web/ and launch one of the following command:

npm test # watch-mode

npm test:local # simple run

npm test:ci # optimized for CI runs