Example #1
0
    def test_should_report_test_name_in_xml_as_name_attribute(self):
        test = XunitTest("test")
        xml = test.to_xml()
        assert_that(xml.attrib['name'], is_("test"))

        test = XunitTest("Nescobar_aloplop")
        xml = test.to_xml()
        assert_that(xml.attrib['name'], is_("Nescobar_aloplop"))
Example #2
0
    def test_should_reporttime_in_xml_as_time_attribute(self):
        test = XunitTest("test")
        xml = test.to_xml()
        assert_that(xml.attrib['time'], is_("0.0"))

        test = XunitTest("test", time=4.4)
        xml = test.to_xml()
        assert_that(xml.attrib['time'], is_("4.4"))
Example #3
0
def from_yaml(yaml_input):
    """Parse provided yaml and instantiate an Xunit object from that"""
    report_description = yaml.load(yaml_input)
    report = Xunit()

    for test_suite, data in report_description.items():
        suite = XunitSuite(test_suite)
        report.append(suite)

        if data is None:
            continue

        for test, test_data in data.items():
            test_result = XunitTest(test, test_suite)
            if test_data and 'status' in test_data:
                test_result.status = test_data['status']
            suite.append(test_result)

    return report
Example #4
0
 def test_should_create_error_node_with_message_in_xml_if_error_test(self):
     test = XunitTest("test", error=True)
     xml = test.to_xml()
     assert_that(xml[0].tag, is_("error"))
     assert_that(xml[0].attrib['message'], is_(""))
Example #5
0
 def test_should_report_test_class_in_xml_as_class_attribute(self):
     test = XunitTest("test", class_name="TestObject")
     xml = test.to_xml()
     assert_that(xml.attrib['classname'], is_("TestObject"))
Example #6
0
 def test_should_generate_xml_node_with_testcase_tag(self):
     test = XunitTest("test")
     xml = test.to_xml()
     assert_that(xml.tag, is_("testcase"))
Example #7
0
 def test_should_create_skipped_node_with_message_in_xml_if_skipped_test(self):
     test = XunitTest("test", skipped=True)
     xml = test.to_xml()
     assert_that(xml[0].tag, is_("skipped"))
Example #8
0
 def test_should_create_failure_node_with_message_in_xml_if_failed_test(self):
     test = XunitTest("test", failed=True)
     xml = test.to_xml()
     assert_that(xml[0].tag, is_("failure"))
     assert_that(xml[0].attrib['message'], is_(""))