Skip to content
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

Don't rely on phpunit/php exit code in CI #550

Closed
DeepDiver1975 opened this issue Apr 4, 2018 · 6 comments
Closed

Don't rely on phpunit/php exit code in CI #550

DeepDiver1975 opened this issue Apr 4, 2018 · 6 comments

Comments

@DeepDiver1975
Copy link
Member

Better evaluate the report xml
see https://github.com/owncloud/core/blob/54cd970b0adf4cc08362aeb0e9876d999d7bd255/build/autotest.sh#L342 how to generate

using xml tools the number of failed/errored unit tests can easily be determined

@patrickjahns
Copy link
Contributor

@DeepDiver1975

Investigated the reports and found that the xml report is not reliable on phpunit 5.7.x - it will not list warnings :'(
https://gist.github.com/patrickjahns/05481849722e162c2e5efc5c369e591f

PHPUNIT 5.7.x allows also for json and teamcity reports, which would include warnings.
However - phpunit 6 has deprecated --log-json format

@patrickjahns
Copy link
Contributor

Some more findings - logIncompleteSkipped="true" might log the warnings - double checking

@patrickjahns
Copy link
Contributor

patrickjahns commented Apr 12, 2018

Annoyingly - junit from phpunit is also not "proper" junit xml - it will have testcase and testsuite elements on the same level for dataproviders

<testsuite>
<testcase></testcase>
<testsuite><testcase></testcase></testsuite>
<testcase></testcase>
</testsuite>

See: https://gist.github.com/patrickjahns/05481849722e162c2e5efc5c369e591f#file-junit-phpunit-5-7-27-incomplete-skipped-xml

@patrickjahns
Copy link
Contributor

As talked - only important for us is to know in the end if we encountered: failures, errors and warnings - we can easily grep them via xpaths //failures

When logIncompleteSkipped is set - we can/need to filter out allowed failure/error events (i.e. PHPUnit_Framework_IncompleteTestError ref: https://gist.github.com/patrickjahns/05481849722e162c2e5efc5c369e591f#file-junit-phpunit-5-7-27-incomplete-skipped-xml-L33 )

@patrickjahns
Copy link
Contributor

patrickjahns commented Mar 21, 2019

Some time ago in another universe I started to work on a parser in go to parse the junitxml and then return exit code 0 || >0
https://gist.github.com/patrickjahns/a3505a7dec49e7780097a00dd02856e5

Would probably 0.5-1md to pick it up and create a small drone plugin to finish it. ( Or write it in another language || research if there is a parser in php? )

Maybe investigate https://github.com/RazeSoldier/JUnitLogParser and create a little phar tool that we can utilize for it?

@patrickjahns
Copy link
Contributor

@phil-davis @individual-it
As you've been working on phpunit - please consider to write a small tool that parses the phpunit files and returns a proper exit code. This makes us independent when exit codes of phpunit fail to report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants