This is creating test cases with a goal. For example, to increase coverage of a test suite, we need to generate test cases that exercise certain statements or follow a path.
Components
- Search algorithm
- Representation: Encoding of the problem solution
- Search operators: Modifications of encoded solutions
- Fitness function: Measure how good a candidate solution is
- Test Execution: Execute the tests
- Instrumentation: Collect traces for fitness calculations during execution
We often use Hillclimbing for our search algorithm which we cover in Fuzzing.
A fitness function can be:
- Code coverage from JaCoCo
- Mutation score from Pit
- Genetic Algorithm
- Here:
- Generate the initial population
- Compute fitness
- REPEAT
- Selection
- Crossover
- Mutation
- Compute fitness
- UNTIL population has converged
- Here: