Search-based techniques have been successfully used to automate test case generation. Such approaches allocate a fixed search budget to generate test cases aiming at maximizing code coverage. The search budget plays a crucial role; due to the hugeness of the search space, the higher the assigned budget, the higher the expected coverage. Code components have different structural properties that may affect the ability of search-based techniques to achieve a high coverage level. Thus, allocating a fixed search budget for all the components is not recommended and a component-specific search budget should be preferred. However, deciding the budget to assign to a given component is not a trivial task. In this paper we introduce BOT, an approach to adaptively allocate the search budget to the classes under test. BOT requires information about the branch coverage that will be achieved on each class with a given search budget. Therefore, we also introduce BRANCHOS, an approach that predicts coverage in a budget-aware way. The results of our experiments show that (i) BRANCHOS can approximate the branch coverage in time with a low error, and (ii) BOT can significantly increase the coverage achieved by a test generation tool and the effectiveness of generated tests.
To replicate the experiments, the requirements are:
- JDK 8
- Ruby (>= 2.5)
- The Ruby gems "rust" (>= 0.4) and "ruby-latex" (>= 0.1)
We release the results of the EvoSuite runs and the files needed to replicate our two experiments involving BRANCHOS and BOT.
- EvoSuite Coverage Results. Contains the results of 5 runs of Evosuite with the coverage achieved for budget levels between 1 and 300 seconds.
- BRANCHOS. Includes two folders: "dataset", which contains the environment for computing the metrics used in the first experiment, and "experiment", i.e., the environment for fully replicating the experiment.
- BOT. Includes two folders: "dataset", which contains the environment for computing and building the datasets, and "experiment", i.e., the environment for fully replicating the experiment.