Home

Awesome

C++ TestMate

A Catch2, GoogleTest, doctest and GoogleBenchmark Explorer for VSCode

Visual Studio Marketplace GitHub issues Visual Studio Marketplace

This extension allows you to run your Catch2, Google Test and DOCtest tests using the native testing vscode-api. It also have basic support for Google Benchmark.

Features / Show-Off

Screenshots

Screenshot1

More features

Configuration

The extension is pre-configured and it should find executables inside the working directory which match the following glob pattern:

{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*

Not good enough for you?!: Edit your .vscode/settings.json file according to the test.advancedExecutables!

testMate.cpp.___Description
test.executablesA glob pattern to find test executables. (Relative to the workspace folder or absolute path.) Empty string means disabled. For more option set testMate.cpp.test.advancedExecutables instead of this. NOTE: if testMate.cpp.test.advancedExecutables is set then this is ignored.
test.advancedExecutablesArray of executables with a lot of options. (If this is set then testMate.cpp.test.executables is ignored.) (Details).
test.workingDirectorySets the working directory of the test executable (relative to the workspace folder or absolute path). Note: testMate.cpp.advancedExecutables overwrites it locally. (Variables)
test.randomGeneratorSeedShuffles the tests with the given random. Catch2: --rng-seed (<integer> or 'time'); Google Test: --gtest_random_seed=<integer>;
test.runtimeLimit[seconds] Test executable is running in a process. In case of an infinite loop it will run forever unless this parameter is set. It applies instantly. (0 means infinite)
test.parallelExecutionLimitMaximum parallel run of tasks. Tasks are 'running a set of tests', 'test executable discovery' and 'reload of the executable's test list'. NOTE: If your executables depend on the same resource exclusively then this could cause a problem.
test.parallelExecutionOfExecutableLimitMaximum number of execution of the same executable. With this config it can be allowed that one executable is running at the same time as multiple processes and those processes 'running a set of tests' parallel. Useful if one executable has a lot of tests which can be run parallel. It won't have effect unless the test.parallelExecutionLimit is adjusted too. To enable this just for specific executables use the testMate.cpp.test.advancedExecutables -> parallelizationLimit. NOTE: if your test cases depend on the same resource exclusively then this could cause a problem.
discovery.loadOnStartupIf true, the extension will try to load all the tests after the startup. Otherwise the user has to click on the Test icon on the sidebar to trigger the process.
discovery.gracePeriodForMissing[seconds] Test executables are being watched (only inside the workspace directory). In case of one recompiles it will try to preserve the test states. If compilation reaches timeout it will drop the suite.
discovery.runtimeLimit[seconds] The timeout of the test-executable used to identify it (Calls the exec with --help).
discovery.testListCachingIn case your executable took too much time to list the tests, one can set this. It will preserve the output of --gtest_list_tests --gtest_output=xml:.... (Beware: Older Google Test doesn't support xml test list format.)
discovery.strictPatternTest loading fails if one of the files matched by test.executable is not a test executable. (Helps noticing unexpected crashes/problems under test loading.)
debug.configTemplateSets the necessary debug configurations and the debug button will work.
debug.breakOnFailureDebugger breaks on failure while debugging the test. Catch2: --break; Google Test: --gtest_break_on_failure; Doctest: --no-breaks
debug.noThrowSkips all assertions that test that an exception is thrown, e.g. REQUIRE_THROWS. This is a Catch2 parameter: --nothrow;
log.logpanelCreates a new output channel and write the log messages there. For debugging. Enabling it could slow down your vscode.
log.logfileWrites the log message into the given file. Empty means disabled.
gtest.treatGmockWarningAsForces the test to be failed even it is passed if it contains the string GMOCK_WARNING:. (You may should consider using testing::StrictMock<T>)
gtest.gmockVerboseSets --gmock_verbose=.... (Note: executable has to be linked to gmock gmock_main not gtest_main)

Plenty of more fine-tuning options are available under test.advancedExecutables like:

Commands

IDCommand
testMate.cmd.reload-testsReload tests
testMate.cmd.reload-workspacesForce reload workspaces (clean slate)
testing.refreshTestsForce reload workspaces (clean slate)

License

Support

Contribution