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

Support flaky tests #541

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
79 changes: 79 additions & 0 deletions python/test/files/junit-xml/flaky.annotations
@@ -0,0 +1,79 @@
[
{
'name': 'Test Results',
'head_sha': 'commit sha',
'status': 'completed',
'conclusion': 'failure',
'output': {
'title': '1 errors, 1 fail, 2 pass in 0s',
'summary':
'1 files\u2004\u20031 suites\u2004\u2003\u20020s '
'[:stopwatch:](https://github.com/EnricoMi/publish-unit-test-result-ac'
'tion/blob/VERSION/README.md#the-symbols "duration of all tests")\n4 '
'tests\u20032 '
'[:heavy_check_mark:](https://github.com/EnricoMi/publish-unit-test-re'
'sult-action/blob/VERSION/README.md#the-symbols "passed tests")\u2003'
'0 '
'[:zzz:](https://github.com/EnricoMi/publish-unit-test-result-action/b'
'lob/VERSION/README.md#the-symbols "skipped / disabled tests")\u20031 '
'[:x:](https://github.com/EnricoMi/publish-unit-test-result-action/blo'
'b/VERSION/README.md#the-symbols "failed tests")\u20031 '
'[:fire:](https://github.com/EnricoMi/publish-unit-test-result-action/'
'blob/VERSION/README.md#the-symbols "test errors")\n2 runs\u2006\u2003'
'0 '
'[:heavy_check_mark:](https://github.com/EnricoMi/publish-unit-test-re'
'sult-action/blob/VERSION/README.md#the-symbols "passed tests")\u2003'
'0 '
'[:zzz:](https://github.com/EnricoMi/publish-unit-test-result-action/b'
'lob/VERSION/README.md#the-symbols "skipped / disabled tests")\u20031 '
'[:x:](https://github.com/EnricoMi/publish-unit-test-result-action/blo'
'b/VERSION/README.md#the-symbols "failed tests")\u20031 '
'[:fire:](https://github.com/EnricoMi/publish-unit-test-result-action/'
'blob/VERSION/README.md#the-symbols "test errors")\n\nResults for '
'commit commit s.\n\n'
'[test-results]:data:application/gzip;base64,H4sIAAAAAAAC/02MQQ6AIAwEv'
'0I4e1Djyc8QghobBUwLJ+PfrYjIbWe3nVMusM8kR9E1QlKEUGCKqAN4x9gy8hCeafiyom'
'gMF/1fbHDU12rRsGfbW8yIHnOD0VF+f+Knawv/tsSVLHHtMt5aCAw5CVq1vG6wyJ3P3QA'
'AAA==\n',
'annotations': [
{
'path': 'example.ExampleTests',
'start_line': 0,
'end_line': 0,
'annotation_level': 'failure',
'message': 'flaky.xml\u2003[took 0s]',
'title': 'throwsAlways (example.ExampleTests) with error',
'raw_details':
'Always throws exception\njava.lang.RuntimeException: Always throws '
'exception\n\tat '
'example.ExampleTests.throwsAlways(ExampleTests.java:26)'
},
{
'path': 'example.ExampleTests',
'start_line': 0,
'end_line': 0,
'annotation_level': 'warning',
'message': 'flaky.xml\u2003[took 0s]',
'title': 'failsAssertionAlways (example.ExampleTests) failed',
'raw_details':
'Always fails assertion ==> expected: <1> but was: <2>\n'
'org.opentest4j.AssertionFailedError: Always fails assertion ==> '
'expected: <1> but was: <2>\n\tat '
'example.ExampleTests.failsAssertionAlways(ExampleTests.java:40)'
},
{
'path': '.github',
'start_line': 0,
'end_line': 0,
'annotation_level': 'notice',
'message': 'There are 4 tests, see "Raw output" for the full list of tests.',
'title': '4 tests found',
'raw_details':
'example.ExampleTests ‑ failsAssertionAlways\nexample.ExampleTests '
'‑ failsAssertionOnlyFirstAttempt\nexample.ExampleTests ‑ '
'throwsAlways\nexample.ExampleTests ‑ throwsOnlyFirstAttempt'
}
]
}
}
]
57 changes: 57 additions & 0 deletions python/test/files/junit-xml/flaky.junit-xml
@@ -0,0 +1,57 @@
<?xml version='1.0' encoding='utf-8'?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="example.ExampleTests" time="0.002" tests="2" errors="1" skipped="0" failures="1">
<testcase name="throwsAlways" classname="example.ExampleTests" time="0.01">
<error message="Always throws exception" type="java.lang.RuntimeException">java.lang.RuntimeException: Always throws exception
at example.ExampleTests.throwsAlways(ExampleTests.java:26)
</error>
<rerunError message="Always throws exception" type="java.lang.RuntimeException">
<stackTrace>java.lang.RuntimeException: Always throws exception
at example.ExampleTests.throwsAlways(ExampleTests.java:26)
</stackTrace>
</rerunError>
<rerunError message="Always throws exception" type="java.lang.RuntimeException">
<stackTrace>java.lang.RuntimeException: Always throws exception
at example.ExampleTests.throwsAlways(ExampleTests.java:26)
</stackTrace>
</rerunError>
<rerunError message="Always throws exception" type="java.lang.RuntimeException">
<stackTrace>java.lang.RuntimeException: Always throws exception
at example.ExampleTests.throwsAlways(ExampleTests.java:26)
</stackTrace>
</rerunError>
</testcase>
<testcase name="failsAssertionAlways" classname="example.ExampleTests" time="0.003">
<failure message="Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;" type="org.opentest4j.AssertionFailedError">org.opentest4j.AssertionFailedError: Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;
at example.ExampleTests.failsAssertionAlways(ExampleTests.java:40)
</failure>
<rerunFailure message="Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;" type="org.opentest4j.AssertionFailedError">
<stackTrace>org.opentest4j.AssertionFailedError: Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;
at example.ExampleTests.failsAssertionAlways(ExampleTests.java:40)
</stackTrace>
</rerunFailure>
<rerunFailure message="Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;" type="org.opentest4j.AssertionFailedError">
<stackTrace>org.opentest4j.AssertionFailedError: Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;
at example.ExampleTests.failsAssertionAlways(ExampleTests.java:40)
</stackTrace>
</rerunFailure>
<rerunFailure message="Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;" type="org.opentest4j.AssertionFailedError">
<stackTrace>org.opentest4j.AssertionFailedError: Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;
at example.ExampleTests.failsAssertionAlways(ExampleTests.java:40)
</stackTrace>
</rerunFailure>
</testcase>
<testcase name="failsAssertionOnlyFirstAttempt" classname="example.ExampleTests" time="0.0">
<flakyFailure message="First attempt fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;" type="org.opentest4j.AssertionFailedError">
<stackTrace>org.opentest4j.AssertionFailedError: First attempt fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;
at example.ExampleTests.failsAssertionOnlyFirstAttempt(ExampleTests.java:32)
</stackTrace>
</flakyFailure>
</testcase>
<testcase name="throwsOnlyFirstAttempt" classname="example.ExampleTests" time="0.001">
<flakyError message="First attempt throws exception" type="java.lang.RuntimeException">
<stackTrace>java.lang.RuntimeException: First attempt throws exception
at example.ExampleTests.throwsOnlyFirstAttempt(ExampleTests.java:18)
</stackTrace>
</flakyError>
</testcase>
</testsuite>
78 changes: 78 additions & 0 deletions python/test/files/junit-xml/flaky.results
@@ -0,0 +1,78 @@
publish.unittestresults.ParsedUnitTestResults(
files=1,
errors=[],
suites=1,
suite_tests=2,
suite_skipped=0,
suite_failures=1,
suite_errors=1,
suite_time=0,
suite_details=[
publish.unittestresults.UnitTestSuite(
name='example.ExampleTests',
tests=2,
skipped=0,
failures=1,
errors=1,
stdout=None,
stderr=None
)
],
cases=[
publish.unittestresults.UnitTestCase(
result_file='flaky.xml',
test_file=None,
line=None,
class_name='example.ExampleTests',
test_name='throwsAlways',
result='error',
message='Always throws exception',
content='java.lang.RuntimeException: Always throws exception\n\tat '
'example.ExampleTests.throwsAlways(ExampleTests.java:26)\n',
stdout=None,
stderr=None,
time=0.01
),
publish.unittestresults.UnitTestCase(
result_file='flaky.xml',
test_file=None,
line=None,
class_name='example.ExampleTests',
test_name='failsAssertionAlways',
result='failure',
message='Always fails assertion ==> expected: <1> but was: <2>',
content='org.opentest4j.AssertionFailedError: Always fails assertion ==> '
'expected: <1> but was: <2>\n\tat '
'example.ExampleTests.failsAssertionAlways(ExampleTests.java:40)\n',
stdout=None,
stderr=None,
time=0.003
),
publish.unittestresults.UnitTestCase(
result_file='flaky.xml',
test_file=None,
line=None,
class_name='example.ExampleTests',
test_name='failsAssertionOnlyFirstAttempt',
result='success',
message=None,
content=None,
stdout=None,
stderr=None,
time=0.0
),
publish.unittestresults.UnitTestCase(
result_file='flaky.xml',
test_file=None,
line=None,
class_name='example.ExampleTests',
test_name='throwsOnlyFirstAttempt',
result='success',
message=None,
content=None,
stdout=None,
stderr=None,
time=0.001
)
]
)
57 changes: 57 additions & 0 deletions python/test/files/junit-xml/flaky.xml
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="example.ExampleTests" time="0.002" tests="2" errors="1" skipped="0" failures="1">
<testcase name="throwsAlways" classname="example.ExampleTests" time="0.01">
<error message="Always throws exception" type="java.lang.RuntimeException"><![CDATA[java.lang.RuntimeException: Always throws exception
at example.ExampleTests.throwsAlways(ExampleTests.java:26)
]]></error>
<rerunError message="Always throws exception" type="java.lang.RuntimeException">
<stackTrace><![CDATA[java.lang.RuntimeException: Always throws exception
at example.ExampleTests.throwsAlways(ExampleTests.java:26)
]]></stackTrace>
</rerunError>
<rerunError message="Always throws exception" type="java.lang.RuntimeException">
<stackTrace><![CDATA[java.lang.RuntimeException: Always throws exception
at example.ExampleTests.throwsAlways(ExampleTests.java:26)
]]></stackTrace>
</rerunError>
<rerunError message="Always throws exception" type="java.lang.RuntimeException">
<stackTrace><![CDATA[java.lang.RuntimeException: Always throws exception
at example.ExampleTests.throwsAlways(ExampleTests.java:26)
]]></stackTrace>
</rerunError>
</testcase>
<testcase name="failsAssertionAlways" classname="example.ExampleTests" time="0.003">
<failure message="Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;" type="org.opentest4j.AssertionFailedError"><![CDATA[org.opentest4j.AssertionFailedError: Always fails assertion ==> expected: <1> but was: <2>
at example.ExampleTests.failsAssertionAlways(ExampleTests.java:40)
]]></failure>
<rerunFailure message="Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;" type="org.opentest4j.AssertionFailedError">
<stackTrace><![CDATA[org.opentest4j.AssertionFailedError: Always fails assertion ==> expected: <1> but was: <2>
at example.ExampleTests.failsAssertionAlways(ExampleTests.java:40)
]]></stackTrace>
</rerunFailure>
<rerunFailure message="Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;" type="org.opentest4j.AssertionFailedError">
<stackTrace><![CDATA[org.opentest4j.AssertionFailedError: Always fails assertion ==> expected: <1> but was: <2>
at example.ExampleTests.failsAssertionAlways(ExampleTests.java:40)
]]></stackTrace>
</rerunFailure>
<rerunFailure message="Always fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;" type="org.opentest4j.AssertionFailedError">
<stackTrace><![CDATA[org.opentest4j.AssertionFailedError: Always fails assertion ==> expected: <1> but was: <2>
at example.ExampleTests.failsAssertionAlways(ExampleTests.java:40)
]]></stackTrace>
</rerunFailure>
</testcase>
<testcase name="failsAssertionOnlyFirstAttempt" classname="example.ExampleTests" time="0.0">
<flakyFailure message="First attempt fails assertion ==&gt; expected: &lt;1&gt; but was: &lt;2&gt;" type="org.opentest4j.AssertionFailedError">
<stackTrace><![CDATA[org.opentest4j.AssertionFailedError: First attempt fails assertion ==> expected: <1> but was: <2>
at example.ExampleTests.failsAssertionOnlyFirstAttempt(ExampleTests.java:32)
]]></stackTrace>
</flakyFailure>
</testcase>
<testcase name="throwsOnlyFirstAttempt" classname="example.ExampleTests" time="0.001">
<flakyError message="First attempt throws exception" type="java.lang.RuntimeException">
<stackTrace><![CDATA[java.lang.RuntimeException: First attempt throws exception
at example.ExampleTests.throwsOnlyFirstAttempt(ExampleTests.java:18)
]]></stackTrace>
</flakyError>
</testcase>
</testsuite>