Example #1
0
def test_create_individual_testrun_results(mock_method):
    mock_method.return_value = ['../assets/artifacts/host03/sample.xml']
    res = create_individual_testrun_results({}, {})
    assert res[0]['sample.xml'] == {
        'total_tests': 4,
        'failed_tests': 0,
        'skipped_tests': 0,
        'passed_tests': 4
    }
Example #2
0
def test_create_individual_testrun_results_1(mock_method):
    """this test verifies xmls with tag testsuite and testsuites work correctly"""
    mock_method.return_value = [
        '../assets/artifacts/host03/sample1.xml',
        '../assets/artifacts/host03/sample.xml'
    ]
    res = create_individual_testrun_results({}, {})
    assert res[0]['sample1.xml'] == {
        'total_tests': 2,
        'failed_tests': 0,
        'skipped_tests': 0,
        'passed_tests': 2
    }
    assert res[1]['sample.xml'] == {
        'total_tests': 4,
        'failed_tests': 0,
        'skipped_tests': 0,
        'passed_tests': 4
    }
Example #3
0
def test_create_individual_testrun_results_with_incorrect_root_tag(
        mock_method):
    """The test case verifies that if the root tag is not testsuites or testsuite, it skips that xml with a warning"""
    mock_method.return_value = ['../assets/artifacts/host03/sample2.xml']
    res = create_individual_testrun_results({}, {})
    assert res == []
Example #4
0
def test_create_individual_testrun_results_with_wrong_xml(mock_method):
    mock_method.return_value = ['../assets/artifacts/host01/sample1.xml']
    with pytest.raises(TefloError) as ex:
        create_individual_testrun_results({}, {})
        assert "The xml file ../assets/artifacts/host01/sample1.xml is malformed" in ex.value.args