An empirical evaluation for object initialization of member variables in unit testing
Evelyn Nicole Haslinger
|Title||An empirical evaluation for object initialization of member variables in unit testing|
|Booktitle||Proceedings of the 2020 IEEE 3rd International Workshop on Validation, Analysis, and Evolution of Software Tests (VST'20)|
Automated test case generation techniques usually aim to maximize some coverage criteria. For object oriented languages, like Java, the branches that can be reached in source code, frequently depend on the internal object state. Meaning certain branches will only be taken, if fields inside the tested class are set to specific values. It is however not obvious how much of the internal object state can be controlled. In this paper, we analyzed a corpus of 110 open source systems to evaluate how settable their classes are. Meaning we looked for ways that fields inside classes can be written. For instance, we analyzed the source code to identify setter methods that can be used to set the values of a field. Our results show that 66.5% of fields can be set to a desired value, while 31.5% of fields may be only settable to particular values or require a more in depth analysis. Only for 2% of fields, we did not find any way to set their values.