junit.testlogger icon indicating copy to clipboard operation
junit.testlogger copied to clipboard

Add system-err and system-out to testcase

Open mclayton7 opened this issue 4 years ago • 7 comments

  • This should fix #41
  • Switches to the Jenkins JUnit 5 xsd, which required the removal of the empty properties tag
  • Add stdout/stderr to system-out and system-err tags to individual test cases

mclayton7 avatar Sep 05 '21 19:09 mclayton7

The other thing I think we need here is to change the documentation in the main readme to reflect the change in the schema we are using.

It should also clarify that the system-out will show up at the test case level AND at the file level. I don't have any good ideas on how to prevent this duplication.

Siphonophora avatar Sep 19 '21 17:09 Siphonophora

@mclayton7 Do you want to circle back to finish this? If you don't have time I will see if I can move it forward.

Siphonophora avatar Nov 07 '21 16:11 Siphonophora

@Siphonophora sorry I lost track of this, I started looking into how other test runners worked in this repository: https://github.com/mclayton7/dotnet_test_output_reporting which led me down the rabbit hole of GitHub actions. I'll pick this back up and try to finish it this weekend!

mclayton7 avatar Nov 10 '21 23:11 mclayton7

@mclayton7 No worries. I appreciate the help.

Siphonophora avatar Nov 12 '21 22:11 Siphonophora

Is this MR still alive? last updates were from 2021.

I have an urgent requirement to provide a way to supress and redirect std-our and std-error from the test results XML to a separate file and wondered if I should pick up from here or start fresh?

Background:

We have multiple test suites generating 170-250 mb of std-out/err per suite. Gitlab completely chokes on such large results files.

We obviously need the output for debugging and diagnostics so suppression on its own isn't good enough, I want to redirect to a secondary log file instead and expose as a build artefact.

Thanks

davetheninja avatar May 26 '22 10:05 davetheninja

@davetheninja This one isn't dead per se, but I think what you are talking about is a different change altogether. It seems like what you really need is a feature flag to suppress logging of all std/error out in the junit report. That would be a simple change, and I could see it making sense to do.

For the other piece, I don't think this logger should do redirection. I would suggest taking a look at the trx or html loggers that are built into vstest. https://github.com/microsoft/vstest-docs/blob/main/docs/report.md

You can run more than one logger at a time dotnet test --logger:"junit" --logger:"trx", so you can still run the junit one for the benefit of gitlab. But then you have the trx file which would give you both the console output AND all the the available context and test results to go with it.

Siphonophora avatar May 26 '22 13:05 Siphonophora

	Yes, actually came to same conclusion after going through the code. Redirection doesn’t fit the contract for the serialiser. That being said, suppression is not an option for me, I need the data available. Have come up with a possible solution which I will try tomorrow where I have the test results cml being generated as usuals, but have a .post hook in gitlab ci stage and use power shell to extract the error and out elements to two log files - removing the out err body within the results xmlThat should hopefully kill both birds with one stone. 

Thanks

David

davetheninja avatar May 26 '22 13:05 davetheninja