arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2102.11678cs.SE
收藏

基于GitHub的Java开源项目测试用例自动识别

Automating Test Case Identification in Java Open Source Projects on GitHub

Matej Madeja, Jaroslav Porubän, Michaela Bačíková, Matúš Sulír, Ján Juhár, Sergej Chodarev, Filip Gurbáľ

摘要:

软件测试是软件质量保证的重要组成部分。许多研究人员从测试人员的动机以及测试应该或不应该如何编写的角度来处理测试过程。然而,从建议中并不知道如何在实际项目中编写测试。本文研究了“test”一词在不同自然语言中的指称;“test”一词出现的次数是否与测试用例的数量相关;以及测试框架的使用情况。该分析是在从430万个GitHub项目中选出的38个GitHub开源存储库上进行的。我们手动分析了803个类中的20,340个测试用例,并使用自动化方法分析了170 k个类。结果表明:(一)存在弱相关性(ii)使用静态文件分析的算法正确检测了97%的测试用例;(iii)15%的分析类使用了main()函数,它代表了在不使用任何第三方的情况下测试生产代码的常规Java程序。党的框架。由于实现的多样性,这种测试的识别非常复杂。这些结果可以被用来更快地识别和定位存储库中的测试用例,理解定制测试解决方案中的实践,以及挖掘测试以提高未来的程序理解。

英文摘要:

Software testing is one of the very important Quality Assurance (QA) components. A lot of researchers deal with the testing process in terms of tester motivation and how tests should or should not be written. However, it is not known from the recommendations how the tests are written in real projects. In this paper, the following was investigated: (i) the denotation of the word "test" in different natural languages; (ii) whether the number of occurrences of the word "test" correlates with the number of test cases; and (iii) what testing frameworks are mostly used. The analysis was performed on 38 GitHub open source repositories thoroughly selected from the set of 4.3M GitHub projects. We analyzed 20,340 test cases in 803 classes manually and 170k classes using an automated approach. The results show that: (i) there exists a weak correlation (r = 0.655) between the number of occurrences of the word "test" and the number of test cases in a class; (ii) the proposed algorithm using static file analysis correctly detected 97% of test cases; (iii) 15% of the analyzed classes used main() function whose represent regular Java programs that test the production code without using any third-party framework. The identification of such tests is very complex due to implementation diversity. The results may be leveraged to more quickly identify and locate test cases in a repository, to understand practices in customized testing solutions, and to mine tests to improve program comprehension in the future.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑