Generating Unit Tests with Descriptive Names Or: Would You Name Your Children Thing1 and Thing2?. Daka, E., Rojas, J. M., & Fraser, G. In ACM Int. Symposium on Software Testing and Analysis (ISSTA), pages 57–67, 2017. ACM.
doi  abstract   bibtex   
The name of a unit test helps developers to understand the purpose and scenario of the test, and test names support developers when navigating amongst sets of unit tests. When unit tests are generated automatically, however, they tend to be given non-descriptive names such as ``test0'', which provide none of the benefits a descriptive name can give a test. The underlying challenge is that automatically generated tests typically do not represent real scenarios and have no clear purpose other than covering code, which makes naming them difficult. In this paper, we present an automated approach which generates descriptive names for automatically generated unit tests by summarizing API-level coverage goals. The tests are optimized to be short, descriptive of the test, have a clear relation to the covered code under test, and allow developers to uniquely distinguish tests in a test suite. An empirical evaluation with 47 participants shows that developers agree with the synthesized names, and the synthesized names are equally descriptive as manually written names. Study participants were even more accurate and faster at matching code and tests with synthesized names compared to manually derived names.
@inproceedings{ISSTA17_IDNaming,
  author    = {Ermira Daka and Jos\'e Miguel Rojas and Gordon Fraser},
  title	    = {Generating Unit Tests with Descriptive Names Or: Would
               You Name Your Children Thing1 and Thing2?},
  booktitle = ISSTA,
  publisher = {ACM},
  year	    = {2017},
  labels    = {conf},
  doi	    = {10.1145/3092703.3092727},
  abstract  = {The name of a unit test helps developers to understand
               the purpose and scenario of the test, and test names
               support developers when navigating amongst sets of unit
               tests. When unit tests are generated automatically,
               however, they tend to be given non-descriptive names
               such as ``test0'', which provide none of the benefits a
               descriptive name can give a test. The underlying
               challenge is that automatically generated tests
               typically do not represent real scenarios and have no
               clear purpose other than covering code, which makes
               naming them difficult. In this paper, we present an
               automated approach which generates descriptive names
               for automatically generated unit tests by summarizing
               API-level coverage goals. The tests are optimized to be
               short, descriptive of the test, have a clear relation
               to the covered code under test, and allow developers to
               uniquely distinguish tests in a test suite. An
               empirical evaluation with 47 participants shows that
               developers agree with the synthesized names, and the
               synthesized names are equally descriptive as manually
               written names. Study participants were even more
               accurate and faster at matching code and tests with
               synthesized names compared to manually derived names.},
  pages	    = {57--67},
  doi	    = {10.1145/3092703.3092727}
}

Downloads: 0