Studying the Evolution of Static Methods and their Effect on Class Testability

Cosmin Marșavina · 2020

While developing complex software projects testing is performed to ensure that the system meets the requirements and functions correctly. However, this activity might be hindered by the lack of testability of the system's production classes. Up until now the studies that address software testability have focused on characteristics related to the project's size and complexity. We are more interested in specific design problems that make a production class difficult to test. Several articles mention the usage of static methods as one of the factors that affect class testability. We would argue that not all static methods have a negative impact on this quality aspect. In order to prove it we first categorize the methods based on 1) the classes of which they are part of and 2) whether or not they utilize mutable state. Then we use historical data to study how they have evolved over the lifespan of a project. Finally, we quantify the testability of production classes by combining code coverage information with test suite metrics for the classes addressing them. An empirical study was conducted using 6 open-source systems to investigate the aspects discussed above. The results highlight multiple categories of static methods that appear more frequently depending on the specific characteristics of a software project. They also confirm our initial expectation that not all static methods affect testability in a negative way.

Read the paper · More papers on PaperTik