An empirical evaluation for object initialization of member variables in unit testing

S. Fischer, E. Haslinger, M. Zimmermann, H. Thaller. An empirical evaluation for object initialization of member variables in unit testing. pages 8-11, 2, 2020.

Autoren
  • Stefan Fischer
  • Evelyn Nicole Haslinger
  • Markus Zimmermann
  • Hannes Thaller
Editoren
  • Martin Pinzger
  • Mag. Rudolf Ramler
BuchProceedings of the 2020 IEEE 3rd International Workshop on Validation, Analysis, and Evolution of Software Tests (VST'20)
TypIn Konferenzband
VerlagIEEE
ISBN978-1-7281-6271-3
Monat2
Jahr2020
Seiten8-11
Abstract

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.