Automated Support for Unit Test Generation: A Tutorial Book Chapter

10/26/2021
by   Afonso Fontes, et al.
0

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 coverage of source code statements. The chapter concludes by discussing more advanced concepts and gives pointers to further reading for how artificial intelligence can support developers and testers when unit testing software.

READ FULL TEXT

page 3

page 4

page 6

page 13

page 15

page 17

page 21

page 25

research
09/11/2020

Generating Accurate Assert Statements for Unit Test Cases using Pretrained Transformers

Unit testing represents the foundational basis of the software testing p...
research
08/09/2022

Google Test/Google Mock to Verify Critical Embedded Software

Critical embedded systems (CES) have become ubiquitous in whether medica...
research
11/01/2020

How Testable is Business Software?

Most businesses rely on a significant stack of software to perform their...
research
06/25/2020

Did You Remember to Test Your Tokens?

Authentication is a critical security feature for confirming the identit...
research
02/13/2020

On Learning Meaningful Assert Statements for Unit Test Cases

Software testing is an essential part of the software lifecycle andrequi...
research
05/18/2020

Generating Unit Tests for Documentation

Software projects capture information in various kinds of artifacts, inc...

Please sign up or login with your details

Forgot password? Click here to reset