Open chilcano opened 5 months ago
I cannot see a file name in your example XML, which is why the links do not work as expected. The <testcase>
tags need a file
attribute that points to the file that cause the test failure. Ideally, you also have the line
attribute. I think those information are currently contained in the <failure>
CDATA content. That has to be used to populate file
and line
.
Here is an example: https://github.com/EnricoMi/publish-unit-test-result-action/blob/master/python/test/files/junit-xml/testsuite-root.xml
Spectral junit report might benefit from this feature..
Thanks @EnricoMi Let me generate a junit file with the expected format. I'll come back to you with my findings.
Regards.
Hello, I'm using Spectral CLI from Github Actions to lint OpenAPI spec files. Once triggered, it generates reports in different formats, even JUnit, which I do use from EnricoMi/publish-unit-test-result-action to publish it as Annotations in Github Action Summary.
The EnricoMi/publish-unit-test-result-action publishes successfully the report as annotations in the Summary view and in the Check runs view. However, the paths and links are wrong and if I click on any of them, it is redirected to Github Code showing the diff view.
I would like to publish the Spectral junit report as annotations with the right paths and links where after clicking on these links i can view the current OpenAPI spec file showing the error or warning in the right line. I've tried
test_file_prefix
without success.I think that Spectral CLI is not generating the junit xml file is a format that EnricoMi/publish-unit-test-result-action does expect. If so, I could edit the generated junit file in run-time.
In this case, what is the expected junit format what should be used to show the OpenAPI spec file in Github Code view with the specific annotation for the corresponding line like EnricoMi/publish-unit-test-result-action shows in its documentation (https://github.com/EnricoMi/publish-unit-test-result-action?tab=readme-ov-file#commit-and-pull-request-annotations)
I appreciate your ideas and support. Kind regards.