JohnnyHendriks / TestAdapter_Catch2

Visual Studio Test Adapter for Catch2
MIT License
105 stars 28 forks source link

Libraries using `printf` reported as test failure. Maybe that could be improved? #34

Closed LYP951018 closed 3 years ago

LYP951018 commented 4 years ago

e.g., what if we add

int start = _xmloutput.IndexOf(@"<Catch ")

to ProcessXml?

I could submit a PR for this.

JohnnyHendriks commented 4 years ago

Thank you for your suggestion. However, the problem with printf is that its output is not captured by the Catch2 framework. As such output generated by printf can appear (semi) randomly in the Catch2 xml reporter output, resulting in invalid XML that cannot be read by an Xml parser.

But as I'm writing this answer I came up with a possible solution. I've been making some changes recently that also effect Xml report handling for an upcoming feature. Based on those changes I now do have an idea to maybe fix this. Basically, instead of reporting to the default output, send the report to a file. Maybe the printf output will then not be intertwined with the Xml report. I will have a look if this helps solve this problem.

JohnnyHendriks commented 4 years ago

Update. I was able to test the possible solution today and it seems to work. As such it will be part of the next release.

JohnnyHendriks commented 3 years ago

Finally released the new version (1.6.0) that fixes this problem. So closing this issue.