Supporting multi-dimensional unit test classification
摘要
In software development projects, unit test names contribute to the overall quality of the tests. Developers often encode contextual information in the test names to enhance the readability and maintainability of tests. However, this information lacks a formal structure, and thus cannot be systematically used to support software development practices such as documentation and test refactoring. Additionally, large test suites can remain hard to read and maintain, even with descriptive test names. To address these limitations, we propose to identify common types of information encoded in test names using prevalent test naming conventions. We introduce a novel rule-based approach, called Sift4J, to automatically extract latent semantic information encoded in the name of a unit test. Information fragments we can extract from test names include the name of the method under test, a description of the state of the object under test, and the expected result of executing the unit under test. We demonstrate how to perform multi-dimensional classification of unit tests using this information. We evaluate the performance of Sift4J on two samples of unit tests: our development set and a previously-unseen evaluation benchmark. The results show that we can extract sufficient information from test names to assist in meaningfully reorganizing the tests in test classes.