Using Relative Lines of Code to Guide Automated Test Generation for Python

by   Josie Holmes, et al.

Raw lines of code (LOC) is a metric that does not, at first glance, seem extremely useful for automated test generation. It is both highly language-dependent and not extremely meaningful, semantically, within a language: one coder can produce the same effect with many fewer lines than another. However, relative LOC, between components of the same project, turns out to be a highly useful metric for automated testing. In this paper, we make use of a heuristic based on LOC counts for tested functions to dramatically improve the effectiveness of automated test generation. This approach is particularly valuable in languages where collecting code coverage data to guide testing has a very high overhead.We apply the heuristic to property-based Python testing using the TSTL (Template Scripting Testing Language) tool. In our experiments, the simple LOC heuristic can improve branch and statement coverage by large margins (often more than 20 fault detection by an even larger margin (usually more than 75 or more). The LOC heuristic is also easy to combine with other approaches, and is comparable to, and possibly more effective than, two well-established approaches for guiding random testing.


page 1

page 2

page 3

page 4


SlipCover: Near Zero-Overhead Code Coverage for Python

Coverage analysis is widely used but can suffer from high overhead. This...

An Empirical Study of Automated Unit Test Generation for Python

Various mature automated test generation tools exist for statically type...

Model-based Automated Testing of JavaScript Web Applications via Longer Test Sequences

JavaScript has become one of the most widely used languages for Web deve...

SmartUnit: Empirical Evaluations for Automated Unit Testing of Embedded Software in Industry

In this paper, we aim at the automated unit coverage-based testing for e...

Improving Tese Case Generation for Python Native Libraries Through Constraints on Input Data Structures

Modern Python projects execute computational functions using native libr...

Differential coverage: automating coverage analysis

While it is easy to automate coverage data collection, it is a time cons...

Ticket Coverage: Putting Test Coverage into Context

There is no metric that determines how well the implementation of a tick...

Please sign up or login with your details

Forgot password? Click here to reset