JohnnyHendriks / TestAdapter_Catch2

Visual Studio Test Adapter for Catch2
MIT License
104 stars 29 forks source link

Test discovery fails with long filenames; unhelpful warning message #27

Closed lalten closed 3 years ago

lalten commented 5 years ago

The attached workspace (problem.zip) shows this problem.

All cpp files contain the same code, but while

Adding the line #define CATCH_CONFIG_CONSOLE_WIDTH 300 to catch2.cpp did resolve this.

It took me really long to figure out that the file name length is the issue here, not the length of the test name.

Maybe you could update the warning to say "Probably too long test name test name or file name, or the test name starts with space characters".

JohnnyHendriks commented 5 years ago

Thank you for reporting this. Especially for making me aware of the CATCH_CONFIG_CONSOLE_WIDTH option. Another workaround that you can use is to use the custom discovery option explained on the Testcase Discovery page.

Regardless I will update the appropriate code and improve the given warning for the next release.

ccourtoyaxis commented 3 years ago

Hi, do you have a new release date for this fix? The Catch2 integration simply does not work.

I have a very small project with only 15 Test Cases, all have short names. GCC: 7.5.0, CMake: 3.10.2, Catch2: 2.13.4 (header only package)

Here is the list of tests:

$ ./testDisplayInterface --list-tests
All available test cases:
  Display
  DisplayInterfaceService
  GraphicGenerator
  GraphicStack
  PatternE
  PatternF
  PatternNothing
  PatternP
  PatternT
  PatternText
  PatternTextTT
  PciConnection
  RehostInterface
  Screen
  Utilities
15 test cases

Yet the plugin gives me the following error:

⚠️ Probably too long test name or the test name starts with space characters! 🛠 - Try to define: #define CATCH_CONFIG_CONSOLE_WIDTH 300) 🛠 - Remove whitespace characters from the beggining of test " (NO DESCRIPTION)"

I have tried the #define CATCH_CONFIG_CONSOLE_WIDTH 300, it does not work and none of my test names have leading spaces.

JohnnyHendriks commented 3 years ago

Finally released a new version (1.6.0) that contains improvements in the area of dealing with long filenames (and long testcase names). There are still corner cases that won't work, but I don't see further room for improvement there. So I'm closing the issue.