Automating Test Case Identification in Java Open Source Projects on GitHub

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 ar X iv :2 10 2. 11 67 8v 2 [ cs .S E ] 3 0 Ju l 2 02 1 1002 M. Madeja, J. Porubän, M. Bač́ıková, M. Suĺır, J. Juhár, S. Chodarev, F. Gurbáľ to mine tests to improve program comprehension in the future.

[1]  Leif Singer,et al.  Creating a shared understanding of testing culture on a social coding site , 2013, 2013 35th International Conference on Software Engineering (ICSE).

[2]  Arie van Deursen,et al.  Refactoring test code , 2001 .

[3]  Oscar Nierstrasz,et al.  Object-oriented reengineering patterns , 2004, Proceedings. 26th International Conference on Software Engineering.

[4]  Hadi Hemmati,et al.  How Effective Are Code Coverage Criteria? , 2015, 2015 IEEE International Conference on Software Quality, Reliability and Security.

[5]  Michaela Bacíková,et al.  Large-Scale Dataset of Local Java Software Build Results , 2020, Data.

[6]  Luis Cruz,et al.  To the attention of mobile software developers: guess what, test your app! , 2019, Empirical Software Engineering.

[7]  David Lo,et al.  Code coverage and test suite effectiveness: Empirical study with real bugs in large systems , 2015, 2015 IEEE 22nd International Conference on Software Analysis, Evolution, and Reengineering (SANER).

[8]  Yijun Yu,et al.  Investigating naming convention adherence in Java references , 2015, 2015 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[9]  David Lo,et al.  Code Coverage and Postrelease Defects: A Large-Scale Study on Open Source Projects , 2017, IEEE Transactions on Reliability.

[10]  Georgios Gousios,et al.  When, how, and why developers (do not) test in their IDEs , 2015, ESEC/SIGSOFT FSE.

[11]  Mario Linares Vásquez,et al.  Improving code readability models with textual features , 2016, 2016 IEEE 24th International Conference on Program Comprehension (ICPC).

[12]  Maria Cláudia Figueiredo Pereira Emer,et al.  The effects of test driven development on internal quality, external quality and productivity: A systematic review , 2016, Inf. Softw. Technol..

[13]  Mohamed Wiem Mkaouer,et al.  On the distribution of test smells in open source Android applications: an exploratory study , 2019, CASCON.

[14]  Tom Mens,et al.  Analyzing the evolution of testing library usage in open source Java projects , 2017, 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER).

[15]  Alex Groce,et al.  Mutations: How Close are they to Real Faults? , 2014, 2014 IEEE 25th International Symposium on Software Reliability Engineering.

[16]  Michael D. Ernst,et al.  Are mutants a valid substitute for real faults in software testing? , 2014, SIGSOFT FSE.

[17]  Darko Marinov,et al.  A Large-Scale Study of Test Coverage Evolution , 2018, 2018 33rd IEEE/ACM International Conference on Automated Software Engineering (ASE).

[18]  S. Williams,et al.  Pearson's correlation coefficient. , 1996, The New Zealand medical journal.

[19]  Andy Zaidman,et al.  On the Relation of Test Smells to Software Code Quality , 2018, 2018 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[20]  Georgios Gousios,et al.  The GHTorent dataset and tool suite , 2013, 2013 10th Working Conference on Mining Software Repositories (MSR).

[21]  Meiyappan Nagappan,et al.  Curating GitHub for engineered software projects , 2017, Empirical Software Engineering.

[22]  David Lo,et al.  Why and how developers fork what from whom in GitHub , 2017, Empirical Software Engineering.

[23]  Cor-Paul Bezemer,et al.  An Exploratory Study of the State of Practice of Performance Testing in Java-Based Open Source Projects , 2017, ICPE.

[24]  Richard E. Mayer,et al.  The Psychology of How Novices Learn Computer Programming , 1981, CSUR.

[25]  David Lo,et al.  Detecting similar repositories on GitHub , 2017, 2017 IEEE 24th International Conference on Software Analysis, Evolution and Reengineering (SANER).

[26]  David Lo,et al.  Understanding the Test Automation Culture of App Developers , 2015, 2015 IEEE 8th International Conference on Software Testing, Verification and Validation (ICST).

[27]  Susan Wiedenbeck,et al.  Mental representations of expert procedural and object-oriented programmers in a software maintenance task , 1999, Int. J. Hum. Comput. Stud..

[28]  Oscar Nierstrasz,et al.  JExample: Exploiting Dependencies between Tests to Improve Defect Localization , 2008, XP.

[29]  William Lewis,et al.  Software Testing and Continuous Quality Improvement , 2000 .

[30]  Michael Ellims,et al.  Unit testing in practice , 2004, 15th International Symposium on Software Reliability Engineering.

[31]  Jaroslav Porubän,et al.  Tracing Naming Semantics in Unit Tests of Popular Github Android Projects , 2019, SLATE.

[32]  Natalia Juristo Juzgado,et al.  A Dissection of the Test-Driven Development Process: Does It Really Matter to Test-First or to Test-Last? , 2016, IEEE Transactions on Software Engineering.

[33]  Mario Linares Vásquez,et al.  How do Developers Test Android Applications? , 2017, 2017 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[34]  Petr Tuma,et al.  Unit Testing Performance in Java Projects: Are We There Yet? , 2017, ICPE.