I originally posted this on another issue and I will delete that comment shortly. The issue I commented on is: #40
We are a .NET shop and utilize NUnit and are a Gitlab customer. We use JUnitXml.Testlogger 3.0.134 configured per your recommendation and Gitlabs own docs and it works great... until we tried to add attachments. No matter what I seem to do, I cannot get the necessary markup into the test results xml output. I thought it may be a matter of me simply using and extensibility point to insert the markup myself using a globally accessible object or method for the JUnitXml.Testlogger lib but I quickly reviewed the source of it and the core logger nothing jumped out at me.
What I have done per other issues in this project and in the NUnit Testlogger which is how I started pulling on this thread where support for attachments was discussed and I traced support back to the core logger for is:
- Make sure the attachments are available from the root of the CI Root in the pipeline (had originally be using temp files but moved them under the same directory as the test results xml themselves.
- We are using the following command to run the tests:
dotnet test ./v${VERSION}.csproj --test-adapter-path:. --logger:"junit;LogFilePath=..\artifacts\sdktest\{assembly}-${VERSION}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --configuration Release
- We are adding attachments using
TestContext.AddTestAttachment(filename, description) where filename is accessible (bullet 1).
- Using NUnit 4.0.1 (.NET 8 but same behavior was observed in .NET 7).
- Attachments work as expected in VS using MSTest (attachments included in test results, clickable, view contents).
- Artifacts are confirmed as stored in the stage, along with the test results XML.
I would think the easiest solution would be to figure out how to get the attachment detail into the resultant XML before its written, either because it is handled by the JUnitXML or core logger OR because it was manually inserted but would love to avoid doing it as a post-processing of the files after they are written but before the stage completes and Gitlab parses the results. The format that Gitlab uses for XML attachments is: https://github.com/testmoapp/junitxml?tab=readme-ov-file#attachments-in-test-output
Does anyone have any pointers on how to achieve this?
I originally posted this on another issue and I will delete that comment shortly. The issue I commented on is: #40
We are a .NET shop and utilize NUnit and are a Gitlab customer. We use JUnitXml.Testlogger 3.0.134 configured per your recommendation and Gitlabs own docs and it works great... until we tried to add attachments. No matter what I seem to do, I cannot get the necessary markup into the test results xml output. I thought it may be a matter of me simply using and extensibility point to insert the markup myself using a globally accessible object or method for the JUnitXml.Testlogger lib but I quickly reviewed the source of it and the core logger nothing jumped out at me.
What I have done per other issues in this project and in the NUnit Testlogger which is how I started pulling on this thread where support for attachments was discussed and I traced support back to the core logger for is:
dotnet test ./v${VERSION}.csproj --test-adapter-path:. --logger:"junit;LogFilePath=..\artifacts\sdktest\{assembly}-${VERSION}-test-result.xml;MethodFormat=Class;FailureBodyFormat=Verbose" --configuration ReleaseTestContext.AddTestAttachment(filename, description)where filename is accessible (bullet 1).I would think the easiest solution would be to figure out how to get the attachment detail into the resultant XML before its written, either because it is handled by the JUnitXML or core logger OR because it was manually inserted but would love to avoid doing it as a post-processing of the files after they are written but before the stage completes and Gitlab parses the results. The format that Gitlab uses for XML attachments is: https://github.com/testmoapp/junitxml?tab=readme-ov-file#attachments-in-test-output
Does anyone have any pointers on how to achieve this?