Best Python code snippet using unittest-xml-reporting_python
testsuite.py
Source:testsuite.py
...31 schema_doc = etree.parse(schema_file)32 schema = etree.XMLSchema(schema_doc)33 return schema34 raise RuntimeError('Could not load JUnit schema') # pragma: no cover35def validate_junit_report(version, text):36 document = etree.parse(BytesIO(text))37 schema = _load_schema(version)38 schema.assertValid(document)39class DoctestTest(unittest.TestCase):40 def test_doctest_example(self):41 suite = doctest.DocTestSuite(tests.doctest_example)42 outdir = BytesIO()43 stream = StringIO()44 runner = xmlrunner.XMLTestRunner(45 stream=stream, output=outdir, verbosity=0)46 runner.run(suite)47 outdir.seek(0)48 output = outdir.read()49 self.assertIn('classname="tests.doctest_example.Multiplicator"'.encode('utf8'), output)50 self.assertIn('name="threetimes"'.encode('utf8'), output)51 self.assertIn('classname="tests.doctest_example"'.encode('utf8'), output)52 self.assertIn('name="twice"'.encode('utf8'), output)53@contextlib.contextmanager54def capture_stdout_stderr():55 """56 context manager to capture stdout and stderr57 """58 orig_stdout = sys.stdout59 orig_stderr = sys.stderr60 sys.stdout = StringIO()61 sys.stderr = StringIO()62 try:63 yield (sys.stdout, sys.stderr)64 finally:65 sys.stdout = orig_stdout66 sys.stderr = orig_stderr67def _strip_xml(xml, changes):68 doc = etree.fromstring(xml)69 for xpath, attributes in changes.items():70 for node in doc.xpath(xpath):71 for attrib in node.attrib.keys():72 if attrib not in attributes:73 del node.attrib[attrib]74 return etree.tostring(doc)75def some_decorator(f):76 # for issue #19577 code = """\78def wrapper(*args, **kwargs):79 return func(*args, **kwargs)80"""81 evaldict = dict(func=f)82 exec(code, evaldict)83 return evaldict['wrapper']84class XMLTestRunnerTestCase(unittest.TestCase):85 """86 XMLTestRunner test case.87 """88 class DummyTest(unittest.TestCase):89 @unittest.skip("demonstrating skipping")90 def test_skip(self):91 pass # pragma: no cover92 @unittest.skip(u"demonstrating non-ascii skipping: éçà ")93 def test_non_ascii_skip(self):94 pass # pragma: no cover95 def test_pass(self):96 pass97 def test_fail(self):98 self.assertTrue(False)99 @unittest.expectedFailure100 def test_expected_failure(self):101 self.assertTrue(False)102 @unittest.expectedFailure103 def test_unexpected_success(self):104 pass105 def test_error(self):106 1 / 0107 def test_cdata_section(self):108 print('<![CDATA[content]]>')109 def test_invalid_xml_chars_in_doc(self):110 """111 Testing comments, -- is not allowed, or invalid xml 1.0 chars such as \x0c112 """113 pass114 def test_non_ascii_error(self):115 self.assertEqual(u"éçà ", 42)116 def test_unsafe_unicode(self):117 print(u"A\x00B\x08C\x0BD\x0C")118 def test_output_stdout_and_stderr(self):119 print('test on stdout')120 print('test on stderr', file=sys.stderr)121 def test_runner_buffer_output_pass(self):122 print('should not be printed')123 def test_runner_buffer_output_fail(self):124 print('should be printed')125 self.fail('expected to fail')126 def test_output(self):127 print('test message')128 def test_non_ascii_runner_buffer_output_fail(self):129 print(u'Where is the café ?')130 self.fail(u'The café could not be found')131 class DummySubTest(unittest.TestCase):132 def test_subTest_pass(self):133 for i in range(2):134 with self.subTest(i=i):135 pass136 def test_subTest_fail(self):137 for i in range(2):138 with self.subTest(i=i):139 self.fail('this is a subtest.')140 def test_subTest_error(self):141 for i in range(2):142 with self.subTest(i=i):143 raise Exception('this is a subtest')144 def test_subTest_mixed(self):145 for i in range(2):146 with self.subTest(i=i):147 self.assertLess(i, 1, msg='this is a subtest.')148 def test_subTest_with_dots(self):149 for i in range(2):150 with self.subTest(module='hello.world.subTest{}'.format(i)):151 self.fail('this is a subtest.')152 class DecoratedUnitTest(unittest.TestCase):153 @some_decorator154 def test_pass(self):155 pass156 class DummyErrorInCallTest(unittest.TestCase):157 def __call__(self, result):158 try:159 raise Exception('Massive fail')160 except Exception:161 result.addError(self, sys.exc_info())162 return163 def test_pass(self):164 # it is expected not to be called.165 pass # pragma: no cover166 class DummyRefCountTest(unittest.TestCase):167 class dummy(object):168 pass169 def test_fail(self):170 inst = self.dummy()171 self.assertTrue(False)172 def setUp(self):173 self.stream = StringIO()174 self.outdir = mkdtemp()175 self.verbosity = 0176 self.runner_kwargs = {}177 self.addCleanup(rmtree, self.outdir)178 def _test_xmlrunner(self, suite, runner=None, outdir=None):179 if outdir is None:180 outdir = self.outdir181 stream = self.stream182 verbosity = self.verbosity183 runner_kwargs = self.runner_kwargs184 if runner is None:185 runner = xmlrunner.XMLTestRunner(186 stream=stream, output=outdir, verbosity=verbosity,187 **runner_kwargs)188 if isinstance(outdir, BytesIO):189 self.assertFalse(outdir.getvalue())190 else:191 self.assertEqual(0, len(glob(os.path.join(outdir, '*xml'))))192 runner.run(suite)193 if isinstance(outdir, BytesIO):194 self.assertTrue(outdir.getvalue())195 else:196 self.assertEqual(1, len(glob(os.path.join(outdir, '*xml'))))197 return runner198 def test_basic_unittest_constructs(self):199 suite = unittest.TestSuite()200 suite.addTest(self.DummyTest('test_pass'))201 suite.addTest(self.DummyTest('test_skip'))202 suite.addTest(self.DummyTest('test_fail'))203 suite.addTest(self.DummyTest('test_expected_failure'))204 suite.addTest(self.DummyTest('test_unexpected_success'))205 suite.addTest(self.DummyTest('test_error'))206 self._test_xmlrunner(suite)207 def test_classnames(self):208 suite = unittest.TestSuite()209 suite.addTest(self.DummyTest('test_pass'))210 suite.addTest(self.DummySubTest('test_subTest_pass'))211 outdir = BytesIO()212 stream = StringIO()213 runner = xmlrunner.XMLTestRunner(214 stream=stream, output=outdir, verbosity=0)215 runner.run(suite)216 outdir.seek(0)217 output = outdir.read()218 output = _strip_xml(output, {219 '//testsuite': (),220 '//testcase': ('classname', 'name'),221 '//failure': ('message',),222 })223 self.assertRegexpMatches(224 output,225 r'classname="tests\.testsuite\.(XMLTestRunnerTestCase\.)?'226 r'DummyTest" name="test_pass"'.encode('utf8'),227 )228 self.assertRegexpMatches(229 output,230 r'classname="tests\.testsuite\.(XMLTestRunnerTestCase\.)?'231 r'DummySubTest" name="test_subTest_pass"'.encode('utf8'),232 )233 def test_expected_failure(self):234 suite = unittest.TestSuite()235 suite.addTest(self.DummyTest('test_expected_failure'))236 outdir = BytesIO()237 self._test_xmlrunner(suite, outdir=outdir)238 self.assertNotIn(b'<failure', outdir.getvalue())239 self.assertNotIn(b'<error', outdir.getvalue())240 self.assertIn(b'<skip', outdir.getvalue())241 def test_unexpected_success(self):242 suite = unittest.TestSuite()243 suite.addTest(self.DummyTest('test_unexpected_success'))244 outdir = BytesIO()245 self._test_xmlrunner(suite, outdir=outdir)246 self.assertNotIn(b'<failure', outdir.getvalue())247 self.assertIn(b'<error', outdir.getvalue())248 self.assertNotIn(b'<skip', outdir.getvalue())249 def test_xmlrunner_non_ascii(self):250 suite = unittest.TestSuite()251 suite.addTest(self.DummyTest('test_non_ascii_skip'))252 suite.addTest(self.DummyTest('test_non_ascii_error'))253 outdir = BytesIO()254 runner = xmlrunner.XMLTestRunner(255 stream=self.stream, output=outdir, verbosity=self.verbosity,256 **self.runner_kwargs)257 runner.run(suite)258 outdir.seek(0)259 output = outdir.read()260 self.assertIn(261 u'message="demonstrating non-ascii skipping: éçà "'.encode('utf8'),262 output)263 def test_xmlrunner_safe_xml_encoding_name(self):264 suite = unittest.TestSuite()265 suite.addTest(self.DummyTest('test_pass'))266 outdir = BytesIO()267 runner = xmlrunner.XMLTestRunner(268 stream=self.stream, output=outdir, verbosity=self.verbosity,269 **self.runner_kwargs)270 runner.run(suite)271 outdir.seek(0)272 output = outdir.read()273 firstline = output.splitlines()[0]274 # test for issue #74275 self.assertIn('encoding="UTF-8"'.encode('utf8'), firstline)276 def test_xmlrunner_check_for_valid_xml_streamout(self):277 """278 This test checks if the xml document is valid if there are more than279 one testsuite and the output of the report is a single stream.280 """281 class DummyTestA(unittest.TestCase):282 def test_pass(self):283 pass284 class DummyTestB(unittest.TestCase):285 def test_pass(self):286 pass287 suite = unittest.TestSuite()288 suite.addTest(unittest.TestLoader().loadTestsFromTestCase(DummyTestA))289 suite.addTest(unittest.TestLoader().loadTestsFromTestCase(DummyTestB))290 outdir = BytesIO()291 runner = xmlrunner.XMLTestRunner(292 stream=self.stream, output=outdir, verbosity=self.verbosity,293 **self.runner_kwargs)294 runner.run(suite)295 outdir.seek(0)296 output = outdir.read()297 # Finally check if we have a valid XML document or not.298 try:299 minidom.parseString(output)300 except Exception as e: # pragma: no cover301 # note: we could remove the try/except, but it's more crude.302 self.fail(e)303 def test_xmlrunner_unsafe_unicode(self):304 suite = unittest.TestSuite()305 suite.addTest(self.DummyTest('test_unsafe_unicode'))306 outdir = BytesIO()307 runner = xmlrunner.XMLTestRunner(308 stream=self.stream, output=outdir, verbosity=self.verbosity,309 **self.runner_kwargs)310 runner.run(suite)311 outdir.seek(0)312 output = outdir.read()313 self.assertIn(u"<![CDATA[ABCD\n]]>".encode('utf8'),314 output)315 def test_xmlrunner_non_ascii_failures(self):316 self._xmlrunner_non_ascii_failures()317 def test_xmlrunner_non_ascii_failures_buffered_output(self):318 self._xmlrunner_non_ascii_failures(buffer=True)319 def _xmlrunner_non_ascii_failures(self, buffer=False):320 suite = unittest.TestSuite()321 suite.addTest(self.DummyTest(322 'test_non_ascii_runner_buffer_output_fail'))323 outdir = BytesIO()324 runner = xmlrunner.XMLTestRunner(325 stream=self.stream, output=outdir, verbosity=self.verbosity,326 buffer=buffer, **self.runner_kwargs)327 # allow output non-ascii letters to stdout328 orig_stdout = sys.stdout329 sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')330 try:331 runner.run(suite)332 finally:333 # Not to be closed when TextIOWrapper is disposed.334 sys.stdout.detach()335 sys.stdout = orig_stdout336 outdir.seek(0)337 output = outdir.read()338 self.assertIn(339 u'Where is the café ?'.encode('utf8'),340 output)341 self.assertIn(342 u'The café could not be found'.encode('utf8'),343 output)344 @unittest.expectedFailure345 def test_xmlrunner_buffer_output_pass(self):346 suite = unittest.TestSuite()347 suite.addTest(self.DummyTest('test_runner_buffer_output_pass'))348 self._test_xmlrunner(suite)349 testsuite_output = self.stream.getvalue()350 # Since we are always buffering stdout/stderr351 # it is currently troublesome to print anything at all352 # and be consistent with --buffer option (issue #59)353 self.assertIn('should not be printed', testsuite_output)354 # this will be fixed when using the composite approach355 # that was under development in the rewrite branch.356 def test_xmlrunner_buffer_output_fail(self):357 suite = unittest.TestSuite()358 suite.addTest(self.DummyTest('test_runner_buffer_output_fail'))359 # --buffer option360 self.runner_kwargs['buffer'] = True361 self._test_xmlrunner(suite)362 testsuite_output = self.stream.getvalue()363 self.assertIn('should be printed', testsuite_output)364 def test_xmlrunner_output_without_buffer(self):365 suite = unittest.TestSuite()366 suite.addTest(self.DummyTest('test_output'))367 with capture_stdout_stderr() as r:368 self._test_xmlrunner(suite)369 output_from_test = r[0].getvalue()370 self.assertIn('test message', output_from_test)371 def test_xmlrunner_output_with_buffer(self):372 suite = unittest.TestSuite()373 suite.addTest(self.DummyTest('test_output'))374 # --buffer option375 self.runner_kwargs['buffer'] = True376 with capture_stdout_stderr() as r:377 self._test_xmlrunner(suite)378 output_from_test = r[0].getvalue()379 self.assertNotIn('test message', output_from_test)380 def test_xmlrunner_stdout_stderr_recovered_without_buffer(self):381 orig_stdout = sys.stdout382 orig_stderr = sys.stderr383 suite = unittest.TestSuite()384 suite.addTest(self.DummyTest('test_pass'))385 self._test_xmlrunner(suite)386 self.assertIs(orig_stdout, sys.stdout)387 self.assertIs(orig_stderr, sys.stderr)388 def test_xmlrunner_stdout_stderr_recovered_with_buffer(self):389 orig_stdout = sys.stdout390 orig_stderr = sys.stderr391 suite = unittest.TestSuite()392 suite.addTest(self.DummyTest('test_pass'))393 # --buffer option394 self.runner_kwargs['buffer'] = True395 self._test_xmlrunner(suite)396 self.assertIs(orig_stdout, sys.stdout)397 self.assertIs(orig_stderr, sys.stderr)398 suite = unittest.TestSuite()399 suite.addTest(self.DummyTest('test_pass'))400 @unittest.skipIf(not hasattr(unittest.TestCase, 'subTest'),401 'unittest.TestCase.subTest not present.')402 def test_unittest_subTest_fail(self):403 # test for issue #77404 outdir = BytesIO()405 runner = xmlrunner.XMLTestRunner(406 stream=self.stream, output=outdir, verbosity=self.verbosity,407 **self.runner_kwargs)408 suite = unittest.TestSuite()409 suite.addTest(self.DummySubTest('test_subTest_fail'))410 runner.run(suite)411 outdir.seek(0)412 output = outdir.read()413 output = _strip_xml(output, {414 '//testsuite': (),415 '//testcase': ('classname', 'name'),416 '//failure': ('message',),417 })418 self.assertRegexpMatches(419 output,420 br'<testcase classname="tests\.testsuite\.'421 br'(XMLTestRunnerTestCase\.)?DummySubTest" '422 br'name="test_subTest_fail \(i=0\)"')423 self.assertRegexpMatches(424 output,425 br'<testcase classname="tests\.testsuite\.'426 br'(XMLTestRunnerTestCase\.)?DummySubTest" '427 br'name="test_subTest_fail \(i=1\)"')428 @unittest.skipIf(not hasattr(unittest.TestCase, 'subTest'),429 'unittest.TestCase.subTest not present.')430 def test_unittest_subTest_error(self):431 # test for issue #155432 outdir = BytesIO()433 runner = xmlrunner.XMLTestRunner(434 stream=self.stream, output=outdir, verbosity=self.verbosity,435 **self.runner_kwargs)436 suite = unittest.TestSuite()437 suite.addTest(self.DummySubTest('test_subTest_error'))438 runner.run(suite)439 outdir.seek(0)440 output = outdir.read()441 output = _strip_xml(output, {442 '//testsuite': (),443 '//testcase': ('classname', 'name'),444 '//failure': ('message',),445 })446 self.assertRegexpMatches(447 output,448 br'<testcase classname="tests\.testsuite\.'449 br'(XMLTestRunnerTestCase\.)?DummySubTest" '450 br'name="test_subTest_error \(i=0\)"')451 self.assertRegexpMatches(452 output,453 br'<testcase classname="tests\.testsuite\.'454 br'(XMLTestRunnerTestCase\.)?DummySubTest" '455 br'name="test_subTest_error \(i=1\)"')456 @unittest.skipIf(not hasattr(unittest.TestCase, 'subTest'),457 'unittest.TestCase.subTest not present.')458 def test_unittest_subTest_mixed(self):459 # test for issue #155460 outdir = BytesIO()461 runner = xmlrunner.XMLTestRunner(462 stream=self.stream, output=outdir, verbosity=self.verbosity,463 **self.runner_kwargs)464 suite = unittest.TestSuite()465 suite.addTest(self.DummySubTest('test_subTest_mixed'))466 runner.run(suite)467 outdir.seek(0)468 output = outdir.read()469 output = _strip_xml(output, {470 '//testsuite': (),471 '//testcase': ('classname', 'name'),472 '//failure': ('message',),473 })474 self.assertNotIn(475 'name="test_subTest_mixed (i=0)"'.encode('utf8'),476 output)477 self.assertIn(478 'name="test_subTest_mixed (i=1)"'.encode('utf8'),479 output)480 @unittest.skipIf(not hasattr(unittest.TestCase, 'subTest'),481 'unittest.TestCase.subTest not present.')482 def test_unittest_subTest_pass(self):483 # Test for issue #85484 suite = unittest.TestSuite()485 suite.addTest(self.DummySubTest('test_subTest_pass'))486 self._test_xmlrunner(suite)487 @unittest.skipIf(not hasattr(unittest.TestCase, 'subTest'),488 'unittest.TestCase.subTest not present.')489 def test_unittest_subTest_with_dots(self):490 # Test for issue #85491 suite = unittest.TestSuite()492 suite.addTest(self.DummySubTest('test_subTest_with_dots'))493 outdir = BytesIO()494 self._test_xmlrunner(suite, outdir=outdir)495 xmlcontent = outdir.getvalue().decode()496 # Method name497 self.assertNotIn('name="subTest', xmlcontent, 'parsing of test method name is not done correctly')498 self.assertIn('name="test_subTest_with_dots (module=\'hello.world.subTest', xmlcontent)499 # Class name500 matchString = 'classname="tests.testsuite.XMLTestRunnerTestCase.DummySubTest.test_subTest_with_dots (module=\'hello.world"'501 self.assertNotIn(matchString, xmlcontent, 'parsing of class name is not done correctly')502 self.assertIn('classname="tests.testsuite.XMLTestRunnerTestCase.DummySubTest"', xmlcontent)503 def test_xmlrunner_pass(self):504 suite = unittest.TestSuite()505 suite.addTest(self.DummyTest('test_pass'))506 self._test_xmlrunner(suite)507 def test_xmlrunner_failfast(self):508 suite = unittest.TestSuite()509 suite.addTest(self.DummyTest('test_fail'))510 suite.addTest(self.DummyTest('test_pass'))511 outdir = BytesIO()512 runner = xmlrunner.XMLTestRunner(513 stream=self.stream, output=outdir,514 verbosity=self.verbosity, failfast=True,515 **self.runner_kwargs)516 runner.run(suite)517 outdir.seek(0)518 output = outdir.read()519 self.assertIn('test_fail'.encode('utf8'), output)520 self.assertNotIn('test_pass'.encode('utf8'), output)521 def test_xmlrunner_verbose(self):522 self.verbosity = 1523 suite = unittest.TestSuite()524 suite.addTest(self.DummyTest('test_pass'))525 self._test_xmlrunner(suite)526 def test_xmlrunner_showall(self):527 self.verbosity = 2528 suite = unittest.TestSuite()529 suite.addTest(self.DummyTest('test_pass'))530 self._test_xmlrunner(suite)531 def test_xmlrunner_cdata_section(self):532 suite = unittest.TestSuite()533 suite.addTest(self.DummyTest('test_cdata_section'))534 self._test_xmlrunner(suite)535 def test_xmlrunner_invalid_xml_chars_in_doc(self):536 suite = unittest.TestSuite()537 suite.addTest(self.DummyTest('test_invalid_xml_chars_in_doc'))538 outdir = BytesIO()539 runner = xmlrunner.XMLTestRunner(540 stream=self.stream, output=outdir, verbosity=self.verbosity,541 **self.runner_kwargs)542 runner.run(suite)543 outdir.seek(0)544 output = outdir.read()545 # Finally check if we have a valid XML document or not.546 try:547 minidom.parseString(output)548 except Exception as e: # pragma: no cover549 # note: we could remove the try/except, but it's more crude.550 self.fail(e)551 def test_xmlrunner_outsuffix(self):552 self.runner_kwargs['outsuffix'] = '.somesuffix'553 suite = unittest.TestSuite()554 suite.addTest(self.DummyTest('test_pass'))555 self._test_xmlrunner(suite)556 xmlfile = glob(os.path.join(self.outdir, '*xml'))[0]557 assert xmlfile.endswith('.somesuffix.xml')558 def test_xmlrunner_nosuffix(self):559 self.runner_kwargs['outsuffix'] = ''560 suite = unittest.TestSuite()561 suite.addTest(self.DummyTest('test_pass'))562 self._test_xmlrunner(suite)563 xmlfile = glob(os.path.join(self.outdir, '*xml'))[0]564 xmlfile = os.path.basename(xmlfile)565 assert xmlfile.endswith('DummyTest.xml')566 def test_junitxml_properties(self):567 suite = unittest.TestSuite()568 suite.addTest(self.DummyTest('test_pass'))569 suite.properties = dict(key='value')570 self._test_xmlrunner(suite)571 def test_junitxml_xsd_validation_order(self):572 suite = unittest.TestSuite()573 suite.addTest(self.DummyTest('test_fail'))574 suite.addTest(self.DummyTest('test_pass'))575 suite.addTest(self.DummyTest('test_output_stdout_and_stderr'))576 suite.properties = dict(key='value')577 outdir = BytesIO()578 runner = xmlrunner.XMLTestRunner(579 stream=self.stream, output=outdir, verbosity=self.verbosity,580 **self.runner_kwargs)581 runner.run(suite)582 outdir.seek(0)583 output = outdir.read()584 # poor man's schema validation; see issue #90585 i_properties = output.index('<properties>'.encode('utf8'))586 i_system_out = output.index('<system-out>'.encode('utf8'))587 i_system_err = output.index('<system-err>'.encode('utf8'))588 i_testcase = output.index('<testcase'.encode('utf8'))589 self.assertTrue(i_properties < i_testcase <590 i_system_out < i_system_err)591 # XSD validation - for good measure.592 validate_junit_report('14c6e39c38408b9ed6280361484a13c6f5becca7', output)593 def test_junitxml_xsd_validation_empty_properties(self):594 suite = unittest.TestSuite()595 suite.addTest(self.DummyTest('test_fail'))596 suite.addTest(self.DummyTest('test_pass'))597 suite.properties = None598 outdir = BytesIO()599 runner = xmlrunner.XMLTestRunner(600 stream=self.stream, output=outdir, verbosity=self.verbosity,601 **self.runner_kwargs)602 runner.run(suite)603 outdir.seek(0)604 output = outdir.read()605 self.assertNotIn('<properties>'.encode('utf8'), output)606 validate_junit_report('14c6e39c38408b9ed6280361484a13c6f5becca7', output)607 @unittest.skipIf(hasattr(sys, 'pypy_version_info'),608 'skip - PyPy + lxml seems to be hanging')609 def test_xunit_plugin_transform(self):610 suite = unittest.TestSuite()611 suite.addTest(self.DummyTest('test_fail'))612 suite.addTest(self.DummyTest('test_pass'))613 suite.properties = None614 outdir = BytesIO()615 runner = xmlrunner.XMLTestRunner(616 stream=self.stream, output=outdir, verbosity=self.verbosity,617 **self.runner_kwargs)618 runner.run(suite)619 outdir.seek(0)620 output = outdir.read()621 validate_junit_report('14c6e39c38408b9ed6280361484a13c6f5becca7', output)622 with self.assertRaises(etree.DocumentInvalid):623 validate_junit_report('ae25da5089d4f94ac6c4669bf736e4d416cc4665', output)624 from xmlrunner.extra.xunit_plugin import transform625 transformed = transform(output)626 validate_junit_report('14c6e39c38408b9ed6280361484a13c6f5becca7', transformed)627 validate_junit_report('ae25da5089d4f94ac6c4669bf736e4d416cc4665', transformed)628 self.assertIn('test_pass'.encode('utf8'), transformed)629 self.assertIn('test_fail'.encode('utf8'), transformed)630 def test_xmlrunner_elapsed_times(self):631 self.runner_kwargs['elapsed_times'] = False632 suite = unittest.TestSuite()633 suite.addTest(self.DummyTest('test_pass'))634 self._test_xmlrunner(suite)635 def test_xmlrunner_resultclass(self):636 class Result(_XMLTestResult):637 pass638 suite = unittest.TestSuite()639 suite.addTest(self.DummyTest('test_pass'))640 self.runner_kwargs['resultclass'] = Result641 self._test_xmlrunner(suite)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!