An oracle is a mechanism to decide whether the outputs of the program for the executed test cases are correct. For machine learning programs, such oracle is not available or too difficult to apply. Metamorphic testing is a testing approach that uses metamorphic relations, which are necessary properties of the software under test to help verify the correctness of a program. Prioritization of metamorphic relations helps to reduce the cost of metamorphic testing [1]. However, prioritizing metamorphic relations based on code coverage is often not effective for prioritizing MRs for machine learning programs, since the decision logic of a machine learning model is learned from training data, and 100% code coverage can be easily achieved with a single test input. To this end, in this work, we propose a cost-effective approach based on diversity in the source and follow-up data set to prioritize metamorphic relations for machine learning programs. We show that the proposed data diversity-based prioritization approach increase the fault detection effectiveness by up to 40% when compared to the code coverage-based approach and reduce the time taken to detect a fault by 29% when compared to random execution of MRs. Overall, our approach leads to saving time and cost during testing.
翻译:甲骨文是一种机制,用以决定所执行测试案例的程序产出是否正确。对于机器学习程序来说,这种甲骨文是不存在的,或者过于难以应用。变形测试是一种测试方法,它使用变形关系,这是正在测试的软件的必要特性,有助于验证程序的正确性。变形关系的优先排序有助于降低变形测试的成本[1]。然而,基于代码覆盖的偏向性关系往往无法有效地确定机器学习程序MR的优先排序,因为机器学习模式的决定逻辑是从培训数据中学习的,而100%的代码覆盖可以通过单一的测试输入轻易实现。为此,我们建议一种基于源的多样性和后续数据集的成本效益方法,以便优先考虑机器学习程序变形关系。我们表明,与基于代码的覆盖方法相比,基于数据的拟议排序方法增加了40%的误差检测效力,并将发现错错的时间减少29%,而与随机执行MR相比,我们的方法可以节省时间和成本。总体而言,我们在测试期间节省时间和成本。