A Visual Studio Extension to run Catch2 unit tests within the Visual Studio TestExplorer.
Use the latest CatchTestAdapter.vsix. It can be installed by double clicking on the downloaded file.
Beginning with Visual Studio 2019 v16.2 the CatchTestAdapter 1.5.1 is broken.
The new TestExplorer Window doesn't accept new test cases as a sub test case.
As a result the Catch2 SECTIONs are no longer shown as sub test cases after the first run.
Now they are shown as sub results of a test case.
- Test cases are shown after discovery process.
- Stack trace link to the source line.
- Catch2
TAGSare implemented as Traits. SECTIONandSCENARIOare shown as sub results.
To run the unit tests against the CatchTestAdapter.dll of the solution, the Local.runsettings file must be loaded.
The TestAdaptersPaths should be adapted to point to the Solution directory.
<TestAdaptersPaths>c:\Path\to\the\Solution\bin\Debug</TestAdaptersPaths> You can configure the adapter by adding a CatchAdapter element to your .runsettings file.
If you do not manually set a runsettings file from the Test menu in Visual Studio, this
adapter will look for *.runsettings files from the solution directory and all its ancestors.
Settings closer to the solution take precedence, lists are merged.
<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
<!-- Catch adapter -->
<CatchAdapter>
<!-- Regexes one of which must match an executable's name
for tests to be searched from it. -->
<TestExeInclude>
<Regex>.*\.Test\.exe</Regex>
</TestExeInclude>
<!-- If one of these regexes matches, the exe is excluded
even if it matches an include. -->
<TestExeExclude>
<Regex>Cheese</Regex>
</TestExeExclude>
</CatchAdapter>
</RunSettings>