예제 #1
0
def test_take_result_median_odd():
    input_json = [{
        "testcase":
        "http://localhost:8000/page_load_test/56.com/www.56.com/index.html",
        "domComplete": 1460358389001,
        "domLoading": 1460358380002
    }, {
        "testcase":
        "http://localhost:8000/page_load_test/56.com/www.56.com/index.html",
        "domComplete": 1460358389002,
        "domLoading": 1460358380001
    }, {
        "testcase":
        "http://localhost:8000/page_load_test/56.com/www.56.com/index.html",
        "domComplete": 1460358389003,
        "domLoading": 1460358380003
    }]

    expected = [{
        "testcase":
        "http://localhost:8000/page_load_test/56.com/www.56.com/index.html",
        "domComplete": 1460358389002,
        "domLoading": 1460358380002
    }]

    assert (expected == runner.take_result_median(input_json, len(input_json)))
예제 #2
0
def test_take_result_median_error():
    input_json = [{
        "testcase": "http://localhost:8000/page_load_test/56.com/www.56.com/index.html",
        "domComplete": None,
        "domLoading": 1460358380002
    }, {
        "testcase": "http://localhost:8000/page_load_test/56.com/www.56.com/index.html",
        "domComplete": 1460358389002,
        "domLoading": 1460358380001
    }]

    expected = [{
        "testcase": "http://localhost:8000/page_load_test/56.com/www.56.com/index.html",
        "domComplete": 1460358389002,
        "domLoading": 1460358380001.5
    }]

    assert(expected == runner.take_result_median(input_json, len(input_json)))