-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support new standard for reporting test results in XML format #3162
Comments
The JUnit5 XSD file referenced in #2964 is not by junit. It is a test resource get from jenkins xunit plugin. |
ages ago, we found sth like JUnit v10: (yeah, no official xsd so far, sadly) also, after issue title got change, you may be interested in checkstyle (don't worry, it's not about only style, but any tool reporting), also widely used on different CI runners: |
I hope this input is in the right spot or is appropriate for this thread. I have been having issues with using the test output of PHPUnit with systems that support JUnit. Proper JUnit support would be ideal (at least in the scope of my own personal implementation), as I have seen JUnit as a widely accepted test format. |
issue is that nobody knows how proper support would look alike, as there is no official data scheme for JUnit format |
yes and no. |
@keradus Forgive me, I'm definitely not the expert when it comes to this. I'm just an end user who consumes PHPUnit and would like to use it in Azure DevOps (and they don't support nested test suites). I wish everyone could agree on an open testing standard, but I don't know if there'd be a way to make it fit everyone's needs given there may be language specific data. |
JUnit 5 does come with an XSD: https://github.com/junit-team/junit5/blob/master/platform-tests/src/test/resources/jenkins-junit.xsd This appears to match most of the third-party XSD's I've been able to find. Nested (Kind of crazy how the entire OS world is using JUnit XML as the de-facto standard, while literally nobody seems to know exactly what it is they supposedly agree on - and we all just go along with it...) |
Lovely, that sounds just like the kind of well-described standard to suit a testig framework. 😨 |
JUnit does not come with an XSD. That XSD was copy for test purpoise (platform-tests project) by the xunit plugin (read the header of XSD). That file was created by Gregory Boissinot, the original author of jenkins xunit plugin making a sort of mixup of all cases found. |
Well, it's part of the test-suite - so, in my optic, it's part of the specification. Regardless of where it originated, this is the spec to which the JUnit codebase itself adheres. Or not? |
My main concern is before allocating effort: is the standard (XSD or not) stable, at least for now? I'm happy to implement it in PHPUnit if so. |
I would agree if and only if the XSD has been included for this purpose. Many test suites also include tests for scenarios that cannot be rolled back because the development community adopted another 'forever beta' thing. In PHPUnit's own collection there are a few guards for old logger behaviour, which frankly isn't great. |
To be considered as a specific it should be explicited in the documentation. Since you had find a test resource this does not mean that it's the official schema documentation. The name of the file jenkins-junit.xsd should be another signal that has nothing to do with it JUnit official schema. You are free to ask to them about if that is an official schema for the JUnit (I would rememeber that till JUnit4 the library does not produce any report in any format JSON or XML or other) |
Right, I don't disagree, it obviously isn't the official schema, but... there isn't one. This appears to be the closest thing to be found in their source-repository or anywhere. |
The point is that JUnit it's just a library to run test. It does not to produce report so there is not reason to define any standard. Who use JUnit an engine and than produce a report than it can define a standard (that could be also in other format like JSON). For now there are two historical executor widely used: Maven and Ant. Both of them defined an own schema for XML report and they are completely different from one another. This is the reason of this issue, define a PHPUnit standard (without any restriction to JUnit) to fit the PHP needs. But till now I did not see any movement. |
Maybe we should create our own logging format for PHPUnit. (Yes, I know, https://xkcd.com/927/.) To some degree this already exists, thanks to @theseer, with the logfiles that are produced using Or we wait and hope that ota4j-team/opentest4j#9 (comment) leads to something we can adopt. |
What would happen to those of use who use php-code-coverage independently of php-unit? |
Thank you for raising this point, @mindplay-dk. This would need to be taken into account. |
Having checkstyle support would be great because with that we also easily get github checks annotations via angeneric script which is already compatible with phpstan, psalm and php-cs-fixer (and every other tool able to generate a checkstyle-formatted report) https://github.com/staabm/annotate-pull-request-from-checkstyle/ |
@sebastianbergmann would you accept a PR adding checkstyle xml reports? as you can see from https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/2.16/src/Report/CheckstyleReporter.php#L35 the implementation would not be complex |
No. I do not believe that Checkstyle XML is a good fit for test results. |
did you see the checks api result-printer https://github.com/mheap/phpunit-github-actions-printer ? we could support this kind of feature easily when the report would be generated in checkstyle format (with a general purpose checkstyle to github annotations converter like https://github.com/staabm/annotate-pull-request-from-checkstyle) |
Superseded by #4321. |
ota4j-team/opentest4j#9 (comment)
The text was updated successfully, but these errors were encountered: