A well-designed fitness function is essential to the effectiveness and efficiency of evolutionary testing. Fitness function design has been researched extensively. For fitness calculation, so far the switchcase construct has been regarded as a nested if-else structure with respect to the control flow. Given a target embraced in a case branch, test data taking different case branches receive different approximation levels. Since the approximation levels received by test data do not evaluate their suitability accurately, the guidance provided by the existing approach to evolutionary search is misleading or lost. Despite the switch-case construct's wide use in industrial applications, no previous work has addressed this problem. In this paper, a Flattened Control Flow Graph and a Flattened Control Dependence Graph for the switch-case construct are first presented, and a unified fitness calculation approach based on Alternative Critical Branches is proposed for the switch-case and other constructs. The concept of Alternative Critical Branches is extended from the single critical branch. Experiments on several large-scale open source programs demonstrate that this approach contributes a much better guidance to evolutionary search.
For switch-case problem, Wang et al. REF converted the control-flow graph and the control-dependencies graph for the switch-case into a flattened control-flow graph and a flattened control-dependence graph.
Fitness calculation approach for the switch-case construct in evolutionary testing
GECCO '08
Computer Science