Exemplo n.º 1
0
def test_failed_to_passed():
    old_suite = suite_mockup("mysuite").add_test(tst_mockup("mytest1", status="failed"))
    new_suite = suite_mockup("mysuite").add_test(tst_mockup("mytest1", status="passed"))

    diff = compute_diff([make_suite_data_from_mockup(old_suite)], [make_suite_data_from_mockup(new_suite)])

    check_diff(diff, status_changed=[["mysuite.mytest1", "failed", "passed"]])
Exemplo n.º 2
0
def test_removed_test():
    old_suite = suite_mockup("mysuite").add_test(tst_mockup("mytest1")).add_test(tst_mockup("mytest2"))
    new_suite = suite_mockup("mysuite").add_test(tst_mockup("mytest1"))

    diff = compute_diff([make_suite_data_from_mockup(old_suite)], [make_suite_data_from_mockup(new_suite)])

    check_diff(diff, removed=["mysuite.mytest2"])
Exemplo n.º 3
0
def test_get_top_steps():
    first_step = step_mockup("step1", start_time=0.0, end_time=1.0)
    second_step = step_mockup("step1", start_time=1.0, end_time=3.0)
    third_step = step_mockup("step2", start_time=3.0, end_time=4.0)

    suite1 = suite_mockup("suite1").add_test(
        tst_mockup().add_step(first_step).add_step(second_step))
    suite2 = suite_mockup("suite2").add_test(tst_mockup().add_step(third_step))

    top_steps = TopSteps.get_top_steps(
        [make_suite_data_from_mockup(suite) for suite in (suite1, suite2)])

    assert len(top_steps) == 2

    assert top_steps[0][0] == "step1"
    assert top_steps[0][1] == "2"
    assert top_steps[0][2] == "1.000s"
    assert top_steps[0][3] == "2.000s"
    assert top_steps[0][4] == "1.500s"
    assert top_steps[0][5] == "3.000s"
    assert top_steps[0][6] == "75%"

    assert top_steps[1][0] == "step2"
    assert top_steps[1][1] == "1"
    assert top_steps[1][2] == "1.000s"
    assert top_steps[1][3] == "1.000s"
    assert top_steps[1][4] == "1.000s"
    assert top_steps[1][5] == "1.000s"
    assert top_steps[1][6] == "25%"
Exemplo n.º 4
0
def test_get_top_tests():
    suite1 = suite_mockup("suite1").add_test(
        tst_mockup("test", start_time=0.0, end_time=1.0))
    suite2 = suite_mockup("suite2").add_test(
        tst_mockup("test", start_time=1.0, end_time=4.0))

    top_suites = TopTests.get_top_tests(
        [make_suite_data_from_mockup(suite) for suite in (suite1, suite2)])
    assert len(top_suites) == 2
    assert top_suites[0][0] == "suite2.test"
    assert top_suites[0][1] == "3.000s"
    assert top_suites[0][2] == "75%"
    assert top_suites[1][0] == "suite1.test"
    assert top_suites[1][1] == "1.000s"
    assert top_suites[1][2] == "25%"
Exemplo n.º 5
0
def test_suite_duration():
    suite = make_suite_data_from_mockup(suite_mockup().add_test(
        tst_mockup(start_time=NOW, end_time=NOW + 1)).add_test(
            tst_mockup(start_time=NOW + 1, end_time=NOW + 2)))
    assert suite.duration == 2
Exemplo n.º 6
0
def test_suite_duration_with_teardown():
    suite = make_suite_data_from_mockup(suite_mockup().add_test(
        tst_mockup(start_time=NOW + 1, end_time=NOW + 2)).add_teardown(
            hook_mockup(start_time=NOW + 2, end_time=NOW + 3)))
    assert suite.duration == 2