def test_should_report_id_in_xml_tag_if_one_is_provided(self): suite = XunitSuite("my_name") result = suite.to_xml(id=2) assert_that(result.attrib['id'], is_("2")) result = suite.to_xml(id=8) assert_that(result.attrib['id'], is_("8"))
def test_should_report_package_in_xml_tag_as_package_attribute_if_present(self): suite = XunitSuite("my_name") result = suite.to_xml() assert_that('package' in result.attrib, is_(False), "shouldn't have package attribute") suite = XunitSuite("my_name", package="Pack1") result = suite.to_xml() assert_that(result.attrib['package'], is_("Pack1"))
def test_should_report_name_in_xml_tag_as_name_attribute(self): suite = XunitSuite("my_name") result = suite.to_xml() assert_that(result.attrib['name'], is_("my_name")) suite = XunitSuite("different_suite") result = suite.to_xml() assert_that(result.attrib['name'], is_("different_suite"))
def test_should_report_total_time_in_xml_tag_as_time_attribute(self): test = test_mock() suite = XunitSuite("my_name") result = suite.to_xml() assert_that(result.attrib['time'], is_("0.0")) suite.append(test) result = suite.to_xml() assert_that(result.attrib['time'], is_("1.5"))
def test_should_report_skip_count_in_xml_tag_as_skipped_attribute(self): test = test_mock("skipped") suite = XunitSuite("my_name") result = suite.to_xml() assert_that(result.attrib['skipped'], is_("0")) suite.append(test) result = suite.to_xml() assert_that(result.attrib['skipped'], is_("1"))
def test_should_append_tests_to_xml_output(self): suite = XunitSuite("my_name") test = test_mock() suite.append(test) xml = suite.to_xml() assert_that(xml[0], is_(test.to_xml()))
def test_should_report_empty_package_if_none_was_provided_and_force_package_is_used(self): suite = XunitSuite("my_name") result = suite.to_xml(force_package=True) assert_that(result.attrib['package'], is_(""))
def test_should_create_testsuite_node_as_xml_output(self): suite = XunitSuite("testsuite") result = suite.to_xml() assert_that(result.tag, is_("testsuite"))