1.5 KiB
1.5 KiB
Creating a test group
-
Create a new test file
Place it under/tests/frontend/or/tests/backend/, following the naming convention below. -
Include the testing framework
Add the following at the top of the file:#include <doctest/doctest.h> -
Register the file in the build system
Add the new test file to/tests/CMakeLists.txtso it’s compiled and executed as part of the test suite. -
Start writing tests!
See doctest docs for more details.
Naming convention
File name should match against the following pattern:
<module>_<feature>_<test_type>_tests.cpp
Where:
<module>- the component or subsystem under test.- Backend modules:
cache|worker - Frontend modules:
work in progress
- Backend modules:
<feature>- a concise, kebab-case description of the specific functionality.<test_type>- one of the following:unitintegratione2e
Examples
| Path | Description |
|---|---|
backend/cache_lru_unit_tests.cpp |
Unit tests for LRU eviction logic in the cache module |
backend/worker_handle-request_unit_tests.cpp |
Unit tests for the request-handling logic in the worker module |