In the field of Search-Based Software Testing (SBST), many metaheuristic searching algorithms are applied such as genetic algorithms, simulated annealing and hill climbing search algorithm, etc to guide the searching process. Therefore, most problems on test generation can be transformed to optimisation problems where tests are iteratively evolved by these effective metaheuristic searching algorithms. In such a scenario, test generation is guided by a problem-specific fitness function whose role is to guide the search towards better solutions from potentially infinite search space, within a practical time limit. Given a Boolean conditional statement, a popular fitness function will estimate how close a test case is to reach this uncovered condition (i.e., true or false), which is defined as branch distance. However, the branch distance does not provide gradient for the search since a Boolean value can only be evaluated to true or false (e.g., if (x && y)
). This dilemma constitutes a well-known domain in SBST called flag problem. Flag problems can be addressed by replacing the Boolean flags with numeric comparisons which provide clearer guidance for the search (e.g., if (5 * 2 > 9 && 2 + 6 < 3)
).
Unfortunately, in an interprocedural flag problem (ipf) case where Boolean flags are passed around as parameters and return values, it is not straightforward to define an semantics-preserving transformation technique which can be universally applied to all ipf cases. Thus, it is not yet supported by state-of-the-art test generators. This project is developed based on the insight that the fitness gradients of ipf can be recovered by making use of runtime information. Given an uncovered interprocedural flag branch, this approach calculates context-sensitive branch distance for all control flows potentially returning the required flag in the called method, and recursively aggregates these distances into a continuous value to guide the search. This approach is implemented on top of the state-of- the-art automatic test suite generation tool for Java EvoSuite framework, and we empirically compare it with its testability transformations on 807 non-trivial methods suffering from ipf problems, sampled from 150 open source Java projects. Our experiment demonstrates that this approach achieves higher overall branch coverage on the investigated methods with statistical significance and acceptable runtime overheads.
Evoif is a tool built on top of Evosuite (http://www.evosuite.org/) , with the support of solving interprocedural flag problem. Apart from supporting interprocedural flag fitness, Evoif also provides facility to run customized scripts to (1) run data set in a batch mode and (2) support remote debugging during the batch experiment.
This website is used for anonymous review for ISSTA 2020. We present runtime parameter for evosuite framework, google drive links for source, binary, and scripts, all subject methods, as well as a brief tutorial of replicating the experiment.
-Dsearch_budget 100 -Dinstrument_context true -Dp_test_delete 0 -Dp_test_change 0.9 -Dp_test_insert 0.3 -Dp_change_parameter 0.6 -Dp_functional_mocking 0 -Dmock_if_no_generator false -Dfunctional_mocking_percent 0 -Dprimitive_reuse_probability 0 -Dmin_initial_tests 10 -Dmax_initial_tests 20 -Ddse_probability 0 -Dinstrument_libraries true -Dinstrument_parent true -Dmax_attempts 100 -Dassertions false -Delite 10 -Ddynamic_pool 0.0 -Dprimitive_pool 0.0 -Djunit_check false
-Dsearch_budget 100 -Dinstrument_context true -Dp_test_delete 0 -Dp_test_change 0.9 -Dp_test_insert 0.3 -Dp_change_parameter 0.6 -Dp_functional_mocking 0 -Dmock_if_no_generator false -Dfunctional_mocking_percent 0 -Dprimitive_reuse_probability 0 -Dmin_initial_tests 10 -Dmax_initial_tests 20 -Ddse_probability 0 -Dinstrument_libraries true -Dinstrument_parent true -Dmax_attempts 100 -Dassertions false -Delite 10 -Ddynamic_pool 0.0 -Dprimitive_pool 0.0 -Djunit_check false
Step1
Step2
Step 3
Step4
Step5
Step6
Step6
First, We show two examples on how EvoIf can improve Evosuite:
In this example, the target method is org.databene.jdbacl.SQLUtil#mutatesStructure(String sql)
from 13_jdbacl project (SF100), which contains two inter-procedural flag (a.k.a, IPF) methods isDDL(String sql)
and isProcedureCall(String sql)
. The target method returns a Boolean value based on the type of input string. Insider both IPF methods, the method normalizeSQL(String sql)
is invoked and also revoke external library org.databene.commons.StringUtil
.
Example.1
In this example, the target method is org.javacc.parser.NfaState#getFirstValidPos(String s, int i, int len)
from 159_javacc project (Extra 50) suffers from the inter-procedural flag method CanMoveUsingChar(char c)
.
CanMoveUsingChar(char c)
). CanMoveUsingChar(char c)
.Example 2