Skip to content

Commit

Permalink
Add expectation files
Browse files Browse the repository at this point in the history
  • Loading branch information
EnricoMi committed Dec 15, 2023
1 parent ff60956 commit 173dcc6
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 0 deletions.
79 changes: 79 additions & 0 deletions python/test/files/junit-xml/flaky.annotations
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
)
]
)

0 comments on commit 173dcc6

Please sign in to comment.