-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add JUnit report logger #458
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #458 +/- ##
============================================
- Coverage 69.86% 67.20% -2.66%
- Complexity 110 155 +45
============================================
Files 26 38 +12
Lines 521 677 +156
============================================
+ Hits 364 455 +91
- Misses 157 222 +65 ☔ View full report in Codecov by Sentry. |
...... 6 / 6 (100%)<?xml version="1.0" encoding="UTF-8"?> | ||
<testsuites><testsuite name="Slow Tests" tests="6" failures="6" errors="0"><testcase name="Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDuration" file="%stest/EndToEnd/Version07/Logger/WithConfigurationAndOption/SleeperTest.php" line="24"><failure type="slow_test"><![CDATA[The actual duration of 0.5%s exceeds the maximum allowed duration of 0.500.]]></failure></testcase><testcase name="Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #0 (600)" file="%stest/EndToEnd/Version07/Logger/WithConfigurationAndOption/SleeperTest.php" line="38"><failure type="slow_test"><![CDATA[The actual duration of 0.6%s exceeds the maximum allowed duration of 0.500.]]></failure></testcase><testcase name="Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #1 (700)" file="%stest/EndToEnd/Version07/Logger/WithConfigurationAndOption/SleeperTest.php" line="38"><failure type="slow_test"><![CDATA[The actual duration of 0.7%s exceeds the maximum allowed duration of 0.500.]]></failure></testcase><testcase name="Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #2 (800)" file="%stest/EndToEnd/Version07/Logger/WithConfigurationAndOption/SleeperTest.php" line="38"><failure type="slow_test"><![CDATA[The actual duration of 0.8%s exceeds the maximum allowed duration of 0.500.]]></failure></testcase><testcase name="Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #3 (900)" file="%stest/EndToEnd/Version07/Logger/WithConfigurationAndOption/SleeperTest.php" line="38"><failure type="slow_test"><![CDATA[The actual duration of 0.9%s exceeds the maximum allowed duration of 0.500.]]></failure></testcase><testcase name="Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #4 (1000)" file="%stest/EndToEnd/Version07/Logger/WithConfigurationAndOption/SleeperTest.php" line="38"><failure type="slow_test"><![CDATA[The actual duration of 1.0%s exceeds the maximum allowed duration of 0.500.]]></failure></testcase></testsuite></testsuites> | ||
|
||
|
||
Detected 6 tests where the duration exceeded the maximum duration. | ||
|
||
1. 1.0%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #4 (1000) | ||
2. 0.9%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #3 (900) | ||
3. 0.8%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #2 (800) | ||
4. 0.7%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #1 (700) | ||
5. 0.6%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #0 (600) | ||
6. 0.5%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks a lot better on version 10, unfortunately, lower versions don't have a --no-output
option.
Detected 6 tests where the duration exceeded the maximum duration. | ||
|
||
1. 1.0%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithNoConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #4 (1000) | ||
2. 0.9%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithNoConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #3 (900) | ||
3. 0.8%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithNoConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #2 (800) | ||
4. 0.7%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithNoConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #1 (700) | ||
5. 0.6%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithNoConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDurationWithDataProvider with data set #0 (600) | ||
6. 0.5%s (0.500) Ergebnis\PHPUnit\SlowTestDetector\Test\EndToEnd\Version07\Logger\WithNoConfigurationAndOption\SleeperTest::testSleeperSleepsLongerThanDefaultMaximumDuration | ||
|
||
Time: %s, Memory: %s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lower versions also don't allow the EXPECTF
section to be empty.
Apologies for the delay, @HypeMC, I'm taking a look at this now! |
@localheinz No problem, I can rebase if needed since there are conflicts, but I don't wanna do it while you're reviewing. |
This pull request adds the ability to generate a JUnit log file for slow tests. Currently, when reviewing a PR, one must go to the CI output to see if there are any slow tests. Now, a JUnit log file can be generated instead and used with GitHub actions:
This makes it easier and more clear to spot slow tests:
To trigger the file generation, all that's required is to add the name of the file to
phpunit.xml
:If PHPUnit is run with the
--log-junit=
option and thejunit-file
parameter is present, the JUnit log for slow tests is generated.Later, if needed, other formats such as testdox could be added.