You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been experimenting with nose2 JUnit XML output plugin in conjunction with unittestsubTest context manager and found that the timestamp attribute is populated correctly only for the first generated testcase node. For the subsequent nodes, the timestamp is set to '1970-01-01T00:00:00'.
A trivial example:
classSubTestReportTest(unittest.TestCase):
deftest_subtests(self):
forcntinrange(10):
withself.subTest("Testing cnt = {}".format(cnt), cnt=cnt):
self.assertLess(cnt, 4, "Verify that the cnt is < 4")
... yields the following XML output:
<testsuiteerrors="0"failures="6"name="nose2-junit"skipped="0"tests="1"time="0.001">
<testcaseclassname="__main__.SubTestReportTest"name="test_subtests [Testing cnt = 4] (cnt=4)"time="0.000497"timestamp="2023-04-05T09:54:42.927951">
<failuremessage="test failure">Traceback (most recent call last):
File "./test_reports.py", line 47, in test_subtests
self.assertLess(cnt, 4, "Verify that the cnt is < 4")
AssertionError: 4 not less than 4 : Verify that the cnt is < 4
</failure>
<system-out />
</testcase>
<testcaseclassname="__main__.SubTestReportTest"name="test_subtests [Testing cnt = 5] (cnt=5)"time="0.000000"timestamp="1970-01-01T00:00:00">
<failuremessage="test failure">Traceback (most recent call last):
File "./test_reports.py", line 47, in test_subtests
self.assertLess(cnt, 4, "Verify that the cnt is < 4")
AssertionError: 5 not less than 4 : Verify that the cnt is < 4
</failure>
<system-out />
</testcase>
<testcaseclassname="__main__.SubTestReportTest"name="test_subtests [Testing cnt = 6] (cnt=6)"time="0.000000"timestamp="1970-01-01T00:00:00">
<failuremessage="test failure">Traceback (most recent call last):
File "./test_reports.py", line 47, in test_subtests
self.assertLess(cnt, 4, "Verify that the cnt is < 4")
AssertionError: 6 not less than 4 : Verify that the cnt is < 4
</failure>
<system-out />
</testcase>
<testcaseclassname="__main__.SubTestReportTest"name="test_subtests [Testing cnt = 7] (cnt=7)"time="0.000000"timestamp="1970-01-01T00:00:00">
<failuremessage="test failure">Traceback (most recent call last):
File "./test_reports.py", line 47, in test_subtests
self.assertLess(cnt, 4, "Verify that the cnt is < 4")
AssertionError: 7 not less than 4 : Verify that the cnt is < 4
</failure>
<system-out />
</testcase>
<testcaseclassname="__main__.SubTestReportTest"name="test_subtests [Testing cnt = 8] (cnt=8)"time="0.000000"timestamp="1970-01-01T00:00:00">
<failuremessage="test failure">Traceback (most recent call last):
File "./test_reports.py", line 47, in test_subtests
self.assertLess(cnt, 4, "Verify that the cnt is < 4")
AssertionError: 8 not less than 4 : Verify that the cnt is < 4
</failure>
<system-out />
</testcase>
<testcaseclassname="__main__.SubTestReportTest"name="test_subtests [Testing cnt = 9] (cnt=9)"time="0.000000"timestamp="1970-01-01T00:00:00">
<failuremessage="test failure">Traceback (most recent call last):
File "./test_reports.py", line 47, in test_subtests
self.assertLess(cnt, 4, "Verify that the cnt is < 4")
AssertionError: 9 not less than 4 : Verify that the cnt is < 4
</failure>
<system-out />
</testcase>
</testsuite>
Ideally, the expected output would be for each failure report to be associated with a timestamp indicating when the failure occurred. Alternatively, it could be a timestamp taken when the test case containing the subTests was started.
The text was updated successfully, but these errors were encountered:
Hello,
I have been experimenting with nose2 JUnit XML output plugin in conjunction with
unittest
subTest
context manager and found that thetimestamp
attribute is populated correctly only for the first generatedtestcase
node. For the subsequent nodes, the timestamp is set to '1970-01-01T00:00:00'.A trivial example:
... yields the following XML output:
Ideally, the expected output would be for each failure report to be associated with a timestamp indicating when the failure occurred. Alternatively, it could be a timestamp taken when the test case containing the
subTest
s was started.The text was updated successfully, but these errors were encountered: