Exemplo n.º 1
0
def test_open_good_xml(filename, record_property):
    record_property('Test Case', '')

    junit_xml = XmlFileParser(filename)

    assert junit_xml is not None
    assert type(junit_xml) is XmlFileParser
Exemplo n.º 2
0
def test_suite():

    junit_xml = XmlFileParser('./data/output.xml')

    suites = Suites(junit_xml.xml_doc)

    suites.next()

    assert type(suites.get_current()) is Element
Exemplo n.º 3
0
def test_states(record_property):
    record_property('Test Case', '')

    suites = Suites(XmlFileParser('./data/multisuite.xml').xml_doc)
    cases = case_builder(suites)

    for case in cases:
        print('INFO: Analysing next test case')
        test_case_id = get_test_case_id_property(case)
        error, fail, warn, skip = get_case_states(case)

        print('INFO: end test case analyse')
def test_properties(record_property):
    record_property('Test Case', '')

    suites = Suites(XmlFileParser('./data/output.xml').xml_doc)

    while suites.next():
        cases = Cases(suites.get_current())

        for case in cases.get_all():
            properties = Properties(case)

            while properties.next():
                print(properties.get_current().getAttribute('name'))
Exemplo n.º 5
0
def test_suite_count(filename, expected_count, record_property):
    record_property('Test Case', '')

    junit_xml = XmlFileParser(filename)

    suites = Suites(junit_xml.xml_doc)

    assert suites is not None

    suite_count = 0
    while suites.next():
        suite_count += 1

    assert suite_count == expected_count
Exemplo n.º 6
0
def test_aggregator(filename):
    junit_xml = XmlFileParser(filename)
    suites = Suites(junit_xml.xml_doc)

    cases = case_builder(suites)

    aggregator = Aggregator()

    aggregator.case_states_aggregation(cases)

    tmp = aggregator.get_aggregated_result()
    for id in tmp:
        print(id, tmp[id].count, tmp[id].passes, tmp[id].error, tmp[id].fails,
              tmp[id].skip, tmp[id].warn,
              tmp[id].passes / tmp[id].count > tmp[id].threshold)
Exemplo n.º 7
0
def test_cases_from_suite(filename, expected_cases, record_property):
    record_property('Test Case', '')

    suites = Suites(XmlFileParser(filename).xml_doc)
    assert suites is not None

    case_count = 0

    while suites.next():
        cases = Cases(suites.get_current())
        assert cases is not None

        for case in cases.get_all():
            case_count += 1

    assert case_count == expected_cases
Exemplo n.º 8
0
def test_open_filenotfound(filename):

    with pytest.raises(FileNotFoundError):
        junit_xml = XmlFileParser(filename)
Exemplo n.º 9
0
def test_open_bad_xml(filename):

    with pytest.raises(xml.parsers.expat.ExpatError):
        junit_xml = XmlFileParser(filename)