def storeMappingInDatabase(testToSourceMapping):
    for test in testToSourceMapping.keys():
        testCase = TestCase.get_by_name(test)
        for func in testToSourceMapping[test]:
            function = Function.get_by_name(func)
            mapping = testCase.get_mapping(function)

            if not mapping:
                testCase.create_mapping(function)
Exemple #2
0
def mapTestsToFunctions(mapping, tests):
    testMapping = dict()
    for test in tests.keys():
        functions = set()
        for func in mapping.keys():
            if func in tests[test]:
                functions.add(func)
                functions.update(mapping[func])
        testMapping[test] = functions

    for test in testMapping.keys():
        print(test + " calls " + str(testMapping[test]))

    for test in testMapping.keys():
        for func in testMapping[test]:
            function = Function.get_by_name(func)
            testCase = TestCase.get_by_name(test)

            testCase.create_mapping(function)

    return testMapping
Exemple #3
0
def searchInDatabase(testCaseName):
    print(TestCase.get_by_name(testCaseName).to_json())
def searchInDatabase(testCaseName):
    tc = TestCase.get_by_name(testCaseName)
    if tc is None:
        print("********* Test case was not found *********")
    else:
        print(TestCase.get_by_name(testCaseName).to_json())
def test_get_by_name_test_case_exists(with_database):
    testCase = TestCase.get_by_name("first_test")
    assert set(testCase.functionsExercised) == set(["doMath"])
    assert set(testCase.filesExercised) == set(["one.r"])
def test_get_by_name_test_case_not_exists(with_database):
    testCase = TestCase.get_by_name("applesauce")
    assert testCase is None