-
Notifications
You must be signed in to change notification settings - Fork 31
Description
After going through the walkthrough, docs and issues a couple of times, I find myself out of ideas as to why the adapter won't discover any tests.
I am building a test project that's a part of a larger solution. It is using catch v2.2.2 and I am using a preview build of Visual Studio 2022. I am only trying to get the tests from an exe, so I am using the minimal runSettings file. The project has multiple .cpp files whose names all end with "Tests.cpp". Therefore, I set my FilenameFilter to "Tests", but I've also tried ".*" . All tests do not have any brackets in their names, but the tags have brackets, e.g. TEST_CASE("Test1", "[Tests]"). Could that be an issue?
What I've done so far:
- Disabled other test adapters
- Put the runSettings in the same folder as the solution+project files. (Not the exe folder)
- Manually set the runSettings file via "select solution wide runSettings file"
- Removed my own main function and only use the wmain in catch.h by defining CATCH_CONFIG_MAIN
- Run the exe with the argument "--list-tests" (Tried both debug and release)
- Tried with and without #define DO_NOT_USE_WMAIN
The runtime console and VS Test output console list all the tests but none are added
========== Starting test discovery ==========
C2A-10644: Started Catch2Adapter exe test discovery...
C2A-18860: Started Catch2Adapter exe test discovery...
C2A-18860: Discover log:
ValidateSourceName name: TestProject
Source: C:\pathToSolution\bin\TestProject.exe
Error Occurred (exit code 128):
DevTools listening on ws://127.0.0.1:8080/devtools/browser/7e48bc45-a4c6-484c-97ba-2f7ef3ace6c5
output:
Matching test cases:
Dummy
C:\pathToSolution\testsrc\testmain.cpp(6)
(NO DESCRIPTION)
[dummy]
TCPServer start
C:\pathToSolution\testsrc\Communication\CommunicationTests.
cpp(14)
(NO DESCRIPTION)
[Communication]
...
...
<!---- Here it continues to list all 128 test cases ------>
...
...
128 matching test cases
Default Verbose Test Discovery:
Testcase count: 0
Accumulated Testcase count: 0
C2A-18860: Start adding test cases to discovery sink
C2A-18860: Finished adding test cases to discovery sink
C2A-18860: Finished Catch2Adapter exe test discovery.
No test is available in C:\pathToSolution\bin\TestProject.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
C2A-10644: Discover log:
ValidateSourceName name: MainProject
Source: C:\pathToSolution\bin\MainProject.exe
Warning: Discovery timeout for C:\pathToSolution\bin\MainProject.exe
Killed process. Threw away following output:
Process Not Found
Process Not Found
[notice ] [Main]: Creating editor window...
Default Verbose Test Discovery:
Testcase count: 0
Accumulated Testcase count: 0
C2A-10644: Start adding test cases to discovery sink
C2A-10644: Finished adding test cases to discovery sink
C2A-10644: Finished Catch2Adapter exe test discovery.
No test is available in C:\pathToSolution\bin\MainProject.exe. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.
========== Test discovery finished: 0 Tests found in 3.5 sec ==========
I noticed that the output lists "128 matching test cases" but then after logs "Testcase count: 0".The second thing I've noticed is that it also looks for tests in the main project when I am only running the test exe. And then there is the "Error Occurred (exit code 128):" which seems to just be the amount of tests the "list" function finds and not an actual error.

my runSettings file:
<RunSettings>
<!-- Adapter Specific sections -->
<Catch2Adapter>
<FilenameFilter>.*</FilenameFilter><!-- Regex filter -->
<IncludeHidden>true</IncludeHidden>
<Logging>debug</Logging>
</Catch2Adapter>
</RunSettings>
Is there anything obvious that I've missed? I'd appreciate any help. Thanks!