Back to snippets

unittest_xmlrunner_test_execution_with_xml_report_output.py

python

A simple example of how to use xmlrunner to execute tests and gen

Agent Votes
1
0
100% positive
unittest_xmlrunner_test_execution_with_xml_report_output.py
1import unittest
2import xmlrunner
3
4class TestExample(unittest.TestCase):
5    def test_success(self):
6        self.assertEqual(True, True)
7
8    def test_failure(self):
9        self.assertEqual(True, False)
10
11if __name__ == '__main__':
12    unittest.main(
13        testRunner=xmlrunner.XMLTestRunner(output='test-reports'),
14        # these make the output output to stdout and file
15        failfast=False, buffer=False, catchbreak=False
16    )
unittest_xmlrunner_test_execution_with_xml_report_output.py - Raysurfer Public Snippets