Allow custom class_name, testcase_name in test_xx_junit_xml. (#119)
* Allow custom class_name and testcase_name in test_xx_junit_xml.
This commit is contained in:
parent
4ea42a76d0
commit
e49604d5bc
|
@ -454,7 +454,7 @@ def read_all(filter_=[]):
|
|||
return root_result
|
||||
|
||||
|
||||
def test_failure_junit_xml(test_name, message, stdout=None):
|
||||
def test_failure_junit_xml(test_name, message, stdout=None, class_name="Results", testcase_name="test_ran"):
|
||||
"""
|
||||
Generate JUnit XML file for a unary test suite where the test failed
|
||||
|
||||
|
@ -472,10 +472,10 @@ def test_failure_junit_xml(test_name, message, stdout=None):
|
|||
testsuite.set('errors', '0')
|
||||
testsuite.set('name', test_name)
|
||||
testcase = ET.SubElement(testsuite, 'testcase')
|
||||
testcase.set('name', 'test_ran')
|
||||
testcase.set('name', testcase_name)
|
||||
testcase.set('status', 'run')
|
||||
testcase.set('time', '1')
|
||||
testcase.set('classname', 'Results')
|
||||
testcase.set('classname', class_name)
|
||||
failure = ET.SubElement(testcase, 'failure')
|
||||
failure.set('message', message)
|
||||
failure.set('type', '')
|
||||
|
@ -484,7 +484,7 @@ def test_failure_junit_xml(test_name, message, stdout=None):
|
|||
system_out.text = cdata(filter_nonprintable_text(stdout))
|
||||
return ET.tostring(testsuite, encoding='utf-8', method='xml')
|
||||
|
||||
def test_success_junit_xml(test_name):
|
||||
def test_success_junit_xml(test_name, class_name="Results", testcase_name="test_ran"):
|
||||
"""
|
||||
Generate JUnit XML file for a unary test suite where the test succeeded.
|
||||
|
||||
|
@ -498,10 +498,10 @@ def test_success_junit_xml(test_name):
|
|||
testsuite.set('errors', '0')
|
||||
testsuite.set('name', test_name)
|
||||
testcase = ET.SubElement(testsuite, 'testcase')
|
||||
testcase.set('name', 'test_ran')
|
||||
testcase.set('name', testcase_name)
|
||||
testcase.set('status', 'run')
|
||||
testcase.set('time', '1')
|
||||
testcase.set('classname', 'Results')
|
||||
testcase.set('classname', class_name)
|
||||
return ET.tostring(testsuite, encoding='utf-8', method='xml')
|
||||
|
||||
def print_summary(junit_results, runner_name='ROSUNIT'):
|
||||
|
|
Loading…
Reference in New Issue