Abstract

Abstract Unit under test identification (UUT) is often difficult due to test smells, such as testing multiple UUTs in one test. Because the tests best reflect the current product specification they can be used to comprehend parts of the production code and the relationships between them. Because there is a similar vocabulary between the test and UUT, five NLP techniques were used on the source code of 5 popular Github projects in this paper. The collected results were compared with the manually identified UUTs. The tf-idf model achieved the best accuracy of 22% for a right UUT and 57% with a tolerance up to fifth place of manual identification. These results were obtained after preprocessing input documents with java keywords removal and word split. The tf-idf model achieved the best model training time and the index search takes within 1s per request, so it could be used in an Integrated Development Environment (IDE) as a support tool in the future. At the same time, it has been found that, for document preprocessing, word splitting improves accuracy best and removing java keywords has just a small improvement for tf-idf model results. Removing comments only slightly worsens the accuracy of Natural Language Processing (NLP) models. The best speed provided the word splitting with average 0.3s preprocessing time per all documents in a project.

Highlights

  • Unit under test identification (UUT) is often difficult due to test smells, such as testing multiple UUTs in one test

  • Because there is a similar vocabulary between the test and UUT, five Natural Language Processing (NLP) techniques were used on the source code of 5 popular Github projects in this paper

  • This paper presented use of 5 NLP techniques on source code of 5 popular Android Github projects

Read more

Summary

Introduction

Abstract: Unit under test identification (UUT) is often difficult due to test smells, such as testing multiple UUTs in one test. The tf-idf model achieved the best accuracy of 22% for a right UUT and 57% with a tolerance up to fifth place of manual identification These results were obtained after preprocessing input documents with java keywords removal and word split. McGlauflin [7] claims that in Java one production class should be tested by only one test class and the programmer is led to this convention using an integrated development environment (IDE) tool In this case it is possible to exactly identify UUT from the test and it can be assumed that the test and production classes will have similar vocabulary. This paper uses 5 natural language processing (NLP) models to help identify UUTs based on the vocabulary of the test, thereby simplifying program comprehension and preventing faults in the code. In the following subsections selected models without mathematical details are described

Latent Semantic Analysis
Latent Dirichlet Allocation
Hierarchical Dirichlet Process
Method
Random Projections
Documents preparation
Model training
Estimating number of topics
Evaluation of document similarity
Optimal topic number
Data preparation
Detected errors of manual identification
Conclusions and future work

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.