Ejemplo n.º 1
0
    def test_to_xml_with_successful_test(self):
        expected_xml = [
            '<?xml version="1.0" encoding="UTF-8"?>',
            '<testsuite failures="0" time="0.02" errors="0" skipped="0" tests="1" name="suiteName">',
            '<properties/>',
            '<testcase time="0.02" classname="className" name="successfulTest">',
            '</testcase>', '</testsuite>'
        ]

        logger = SurefireSuiteLogger('suiteName', Mock())
        logger.success(name="successfulTest", time=0.02, classname="className")

        self.assertEqual(expected_xml, logger.to_xml())
    def test_to_xml_with_successful_test(self):
        expected_xml = [
            '<?xml version="1.0" encoding="UTF-8"?>',
            '<testsuite failures="0" time="0.02" errors="0" skipped="0" tests="1" name="suiteName">',
            '<properties/>',
            '<testcase time="0.02" classname="className" name="successfulTest">',
            '</testcase>',
            '</testsuite>'
        ]

        logger = SurefireSuiteLogger('suiteName', Mock())
        logger.success(name="successfulTest", time=0.02, classname="className")

        self.assertEqual(expected_xml, logger.to_xml())
    def test_to_xml_with_failed_test(self):
        expected_xml = [
            '<?xml version="1.0" encoding="UTF-8"?>',
            '<testsuite failures="1" time="0.01" errors="0" skipped="0" tests="1" name="suiteName">',
            '<properties/>',
            '<testcase time="0.01" classname="className" name="failedTest">',
            '<failure>log lines</failure>',
            '</testcase>',
            '</testsuite>'
        ]

        logger = SurefireSuiteLogger('suiteName', Mock())
        logger.failed(name="failedTest", time=0.01, classname="className", log="log lines")

        self.assertEqual(expected_xml, logger.to_xml())
Ejemplo n.º 4
0
    def test_to_xml_with_failed_test(self):
        expected_xml = [
            '<?xml version="1.0" encoding="UTF-8"?>',
            '<testsuite failures="1" time="0.01" errors="0" skipped="0" tests="1" name="suiteName">',
            '<properties/>',
            '<testcase time="0.01" classname="className" name="failedTest">',
            '<failure>log lines</failure>', '</testcase>', '</testsuite>'
        ]

        logger = SurefireSuiteLogger('suiteName', Mock())
        logger.failed(name="failedTest",
                      time=0.01,
                      classname="className",
                      log="log lines")

        self.assertEqual(expected_xml, logger.to_xml())