diff options
| author | Stefan Boberg <[email protected]> | 2026-03-02 09:37:14 +0100 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2026-03-02 09:37:14 +0100 |
| commit | d604351cb5dc3032a7cb8c84d6ad5f1480325e5c (patch) | |
| tree | ecf3e5a0de3ae58e2f81988b72ae520a347d4433 /CLAUDE.md | |
| parent | added `--verbose` option to zenserver-test and `xmake test` (#798) (diff) | |
| download | zen-d604351cb5dc3032a7cb8c84d6ad5f1480325e5c.tar.xz zen-d604351cb5dc3032a7cb8c84d6ad5f1480325e5c.zip | |
Add test suites (#799)
Makes all test cases part of a test suite. Test suites are named after the module and the name of the file containing the implementation of the test.
* This allows for better and more predictable filtering of which test cases to run which should also be able to reduce the time CI spends in tests since it can filter on the tests for that particular module.
Also improves `xmake test` behaviour:
* instead of an explicit list of projects just enumerate the test projects which are available based on build system state
* also introduces logic to avoid running `xmake config` unnecessarily which would invalidate the existing build and do lots of unnecessary work since dependencies were invalidated by the updated config
* also invokes build only for the chosen test targets
As a bonus, also adds `xmake sln --open` which allows opening IDE after generation of solution/xmake project is done.
Diffstat (limited to 'CLAUDE.md')
| -rw-r--r-- | CLAUDE.md | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -70,6 +70,31 @@ xmake test --run=all --junit Tests use the **doctest** framework. To run server tests: `xmake run zenserver test` +### Test Suite Naming Convention + +All `TEST_CASE` blocks must be wrapped in a `TEST_SUITE_BEGIN`/`TEST_SUITE_END` pair (not the `TEST_SUITE()` wrapper macro, to avoid reformatting). Suite names follow the pattern `{module}.{filename}` where the `zen` prefix is stripped from the module name: + +| Module | File | Suite name | +|---|---|---| +| `zencore` | `filesystem.cpp` | `"core.filesystem"` | +| `zenstore` | `blockstore.cpp` | `"store.blockstore"` | +| `zenhttp` | `httpclient.cpp` | `"http.httpclient"` | +| `zenutil` | `wildcard.cpp` | `"util.wildcard"` | +| `zennet` | `statsdclient.cpp` | `"net.statsdclient"` | +| `zentelemetry` | `stats.cpp` | `"telemetry.stats"` | +| `zenremotestore` | `chunkblock.cpp` | `"remotestore.chunkblock"` | +| `zenserver-test` | `cache-tests.cpp` | `"server.cache"` | + +Each test executable defaults to running only the suites for its own module (e.g. `zencore-test` defaults to `core.*`). This default is derived automatically from the executable name by `RunTestMain` and can be overridden on the command line: + +```bash +# Run only filesystem tests within zencore-test +zencore-test --test-suite=core.filesystem + +# Run all core tests (default behaviour, no flag needed) +zencore-test +``` + ### Code Formatting ```bash @@ -168,6 +193,7 @@ The codebase is organized into layered modules with clear dependencies: **Naming Conventions (UE-inspired with modifications):** - Classes/Structs: `PascalCase` - Functions/Methods: `PascalCase()` +- Function parameters/local variables: `PascalCase` - Member variables: `m_PascalCase` - Global variables: `g_PascalCase` - Static variables: `s_PascalCase` |