How to write unit tests for wxWidgets ===================================== wxWidgets unit tests use [Catch](http://catch-lib.net/) framework. It is included in wxWidgets as a submodule, so you will need to run $ git submodule update --init 3rdparty/catch to get it before the first use. Catch is header-only and doesn't need to be compiled. Testing with Catch ------------------ **WARNING**: Most of the existing tests are currently still written in the CppUnit style, please do _not_ follow them when writing new tests, the old style is too complex and unnecessary. Writing tests with Catch is almost embarrassingly simple: you need to just add a new test case and use Catch assertion macros inside it, e.g. TEST_CASE("MyNewTest", "[my][new][another-tag]") { wxString s("Hello, world!"); CHECK( s.BeforeFirst(",") == "Hello" ); CHECK( s.AfterLast(" ") == "world!" ); } This is all, the new test will be automatically run when you run the full test suite or you can run just it using $ ./test MyNewTest (see below for more about running tests). See [Catch tutorial](hhttps://github.com/philsquared/Catch/blob/v1.11.0/docs/tutorial.md) for more information. Tests physical structure ------------------------ All (i.e. both GUI and non-GUI) unit tests are under `tests` subdirectory. When adding a new test, try to find an existing file to add it to. If there are no applicable files, try to add a new file to an existing directory. If there is no applicable directory neither, create a new one and put the new file there (i.e. do _not_ put new files directly under `tests`). If your test is small, consider adding it to `tests/misc/misctests.cpp`. If you add a new file, you need to update `tests/test.bkl` and add a `` tag for your new file.bkl. Make sure it's in the correct section: the one starting `