Skip to content

Per-DLL Test Registry and Public Runner API for Catch2 #3018

@kkutsner

Description

@kkutsner

Description

Currently, Catch2 can be built as a DLL, but building test modules as DLLs (rather than executables) and running them via a custom test runner is difficult due to the following limitations:

  • The test registry is global to the process. When Catch2 is linked dynamically, all loaded test DLLs share the same registry, causing all tests to be registered together and making isolation impossible.
  • To run tests programmatically, one must use private APIs, which are undocumented and subject to change.

Feature Request

  • Provide a way to define the test registry in a specific location (e.g., within each test DLL or the test runner), rather than always in Catch2.dll.
  • Expose a public API to enumerate and run individual tests from a registry, enabling custom runners to load and execute tests from multiple DLLs in isolation.

Additional Context

This feature would enable large projects to reduce binary size by sharing a single Catch2 DLL, and allow integration with other test harnesses (e.g., Python's unittest or pytest) by wrapping Catch2 tests. It would also facilitate advanced workflows, such as running tests in-process with custom UI or helpers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions