Skip to content

Commit

Permalink
test for no time in junit xml format
Browse files Browse the repository at this point in the history
  • Loading branch information
ira committed Dec 25, 2015
1 parent 9e3d125 commit 135f953
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cdws_api/testdata/junit-test-report-notime.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="test" tests="4" assertions="4" failures="1" errors="1" time="10.0">
<testcase name="passedTest" class="Test"/>
<testcase name="failedTest" class="Test">
<failure>Failure message</failure>
</testcase>
<testcase name="failedTest" class="Test">
<error>Error message</error>
<system-out>System-out</system-out>
</testcase>
<testcase name="skippedTest" class="Test">
<skipped>Skipped message</skipped>
</testcase>
</testsuite>
</testsuites>
13 changes: 13 additions & 0 deletions cdws_api/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,19 @@ def test_upload_junit_file(self):
self.assertEqual(1, passed['count'])
self.assertEqual(0.4, launch['duration'])

def test_upload_junit_file_notime(self):
project = Project.objects.create(name='DummyTestProject')
testplan = TestPlan.objects.create(name='DummyTestPlan',
project=project)
self._post(file_name='junit-test-report-notime.xml',
url='{}/junit/junit.xml'.format(testplan.id))

launches = self._call_rest('get',
'launches/?testplan={}'.format(testplan.id))
self.assertEqual(1, launches['count'])
launch = launches['results'][0]
self.assertEqual(0.0, launch['duration'])

def test_upload_nunit_file(self):
project = Project.objects.create(name='DummyTestProject')
testplan = TestPlan.objects.create(name='DummyTestPlan',
Expand Down

0 comments on commit 135f953

Please sign in to comment.