Upgrade to Pro — share decks privately, control downloads, hide ads and more …

An Empirical Investigation on the Readability of Manual and Generated Test Cases

An Empirical Investigation on the Readability of Manual and Generated Test Cases

Software testing is one of the most crucial tasks in the typical development process. Developers are usually required to write unit test cases for the code they implement. Since this is a time-consuming task, in last years many approaches and tools for automatic test case generation — such as EvoSuite — have been introduced. Nevertheless, developers have to maintain and evolve tests to sustain the changes in the source code; therefore, having readable test cases is important to ease such a process. However, it is still not clear whether developers make an effort in writing readable unit tests. Therefore, in this paper, we conduct an explorative study comparing the readability of manually written test cases with the classes they test. Moreover, we deepen such analysis looking at the readability of automatically generated test cases. Our results suggest that developers tend to neglect the readability of test cases and that automatically generated test cases are generally even less readable than manually written ones.

Giovanni Grano

May 28, 2018
Tweet

More Decks by Giovanni Grano

Other Decks in Research

Transcript

  1. An Empirical Investigation on the Readability of Manual and Generated

    Test Cases G. Grano, S. Scalabrino, H. C. Gall, R. Oliveto ICPC ERA 2018, 27-28 May, Gothenburg (Sweden) [email protected] giograno90
  2. Time spent with tests 1 > 416 software engineers for

    over 13 years of recorded working time in the IDE > Developers spend 25% of their time engineering tests in their IDE > They look at tests when errors occur 1 Beller et.al - When, How, and Why Developers (Do Not) Test in Their IDEs 4 — Giovanni Grano @ s.e.a.l.
  3. Same level of quality Same effort in writing good quality

    tests and production code > Changes are easier > Error comprehension 5 — Giovanni Grano @ s.e.a.l.
  4. Study Design > 3 Apache open-source projects > state-of-the-art readability

    model 2 > pairs of <test-production code> > Wilcoxon Test 2 Scalabrino et.al. - Improving Code Readability Models with Textual Features - ICPC 2016 8 — Giovanni Grano @ s.e.a.l.
  5. Features > Structural Features (e.g. line length) > Visual Features

    (e.g. indentation) > Text-Based Code Readability Features (e.g. Comments and Identifiers Consistency) 9 — Giovanni Grano @ s.e.a.l.
  6. Future work Why readability of test is lower? > good

    proxy for quality? > increase awareness > support test quality Can we improve the tools? 15 — Giovanni Grano @ s.e.a.l.