Stateful Testing: Finding More Errors in Code and Contracts
Yi Wei, Hannes Roth, Carlo A. Furia, Yu Pei, Alexander Horton, Michael, Steindorfer, Martin Nordio, Bertrand Meyer

TL;DR
Stateful testing is an automated technique that enhances existing test suites by generating test cases that challenge inferred contracts, leading to more error detection and more accurate contracts with minimal overhead.
Contribution
The paper introduces stateful testing, a novel method that improves test input diversity and contract accuracy by targeting dynamically inferred invariants.
Findings
Found 68.4% new errors in data structure classes
Improved contract accuracy to over 99%
Achieved only 7% additional testing time
Abstract
Automated random testing has shown to be an effective approach to finding faults but still faces a major unsolved issue: how to generate test inputs diverse enough to find many faults and find them quickly. Stateful testing, the automated testing technique introduced in this article, generates new test cases that improve an existing test suite. The generated test cases are designed to violate the dynamically inferred contracts (invariants) characterizing the existing test suite. As a consequence, they are in a good position to detect new errors, and also to improve the accuracy of the inferred contracts by discovering those that are unsound. Experiments on 13 data structure classes totalling over 28,000 lines of code demonstrate the effectiveness of stateful testing in improving over the results of long sessions of random testing: stateful testing found 68.4% new errors and improved the…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
