Skip to content
/ tst Public

C++ xUnit-like testing framework without macros

License

Notifications You must be signed in to change notification settings

cppfw/tst

Repository files navigation

releases

ci status

tst

C++ testing framework.

Installation, documentation, tutorials

See WiKi.

Features

  • xUnit-like concepts

  • minimal use of preprocessor macros

  • declarative definition of test cases

  • test suites

  • parametrized test cases

  • disabled test cases

  • parallel test execution

  • tests discovery (list existing test cases)

  • run list (list of test cases to run)

  • JUnit XML report generation

  • custom command line arguments

  • colored console output

Why another C++ xUnit framework?

There is already a plenty of C++ testing frameworks. The most popular ones are GoogleTest, Catch2 and Boost.UT.

So why another one?

Well, the good coding exercise is not the last reason, but also the following ones which make tst different:

  • tst minimizes use of preprocessor macros. It is designed with keeping in mind the future use of std::source_location when it becomes widely supported by compilers. Then it will be possible to avoid using macros at all without much rewriting of existing tests. Right now, essentially only one small macro is required, which is SL. For the sake of justice, Boost.UT also works without macros.

  • tst does not require C++'20 yet (unlike Boost.UT). Works with C++'17 which is well supported by existing compilers.

  • tst takes in use latest C++ concepts without being limited by supporting legacy standards.

  • Simple and clean procedural approach to testing (no awkward BDD, Gherkin, etc. stuff).

  • Exception-based "assertions" (check() functions).

  • Built-in parallel test cases execution.