Automated Support for Unit Test Generation: A Tutorial Book Chapter
Afonso Fontes, Gregory Gay, Francisco Gomes de Oliveira Neto, Robert, Feldt

TL;DR
This paper introduces search-based AI techniques for automating the generation of unit tests, aiming to reduce manual effort and improve code coverage in software testing.
Contribution
It presents two algorithms that generate pytest-formatted unit tests using optimization and metaheuristic search, advancing automated test generation methods.
Findings
Algorithms effectively generate unit tests with high code coverage.
Search-based approach reduces manual effort in test creation.
Framework supports integration with existing testing tools.
Abstract
Unit testing is a stage of testing where the smallest segment of code that can be tested in isolation from the rest of the system - often a class - is tested. Unit tests are typically written as executable code, often in a format provided by a unit testing framework such as pytest for Python. Creating unit tests is a time and effort-intensive process with many repetitive, manual elements. To illustrate how AI can support unit testing, this chapter introduces the concept of search-based unit test generation. This technique frames the selection of test input as an optimization problem - we seek a set of test cases that meet some measurable goal of a tester - and unleashes powerful metaheuristic search algorithms to identify the best possible test cases within a restricted timeframe. This chapter introduces two algorithms that can generate pytest-formatted unit tests, tuned towards…
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.
Taxonomy
TopicsSoftware Testing and Debugging Techniques · Software Engineering Research · Software Reliability and Analysis Research
MethodsTest
