Skip to content

Added the ability to set set_attribute #227

Open
@klookAppTest

Description

@klookAppTest

I need to customize the attribute in the case

For example

import unittest
import xmlrunner
from xmlrunner.result import set_attribute


class TestSequenceFunctions(unittest.TestCase):

    def test_sample(self):
        set_attribute({"jira": "0001", "case_id": "1001"})


if __name__ == '__main__':
    with open('./results.xml', 'wb') as output:
        unittest.main(
            testRunner=xmlrunner.XMLTestRunner(output=output),
            failfast=False, buffer=False, catchbreak=False)

result.xml

<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
	<testsuite errors="0" failures="0" file=".py" name="TestSequenceFunctions-20200827100320" skipped="0" tests="1" time="0.007" timestamp="2020-08-27T10:03:20">
		<testcase case_id="1001" classname="TestSequenceFunctions" file="best_sample.py" jira="0001" line="9" name="test_sample" time="0.007" timestamp="2020-08-27T10:03:20">
			<system-out>
<![CDATA[{"jira": "0001", "case_id": "1001"}]]>			</system-out>
		</testcase>
	</testsuite>
</testsuites>

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs_5_whysrequest is unclear and needs more information as to why we need the change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions