Patent ID: 8572555

Claim:
A method of generating a test case for testing a program, the program containing a set of computer-readable instructions recorded on a computer-readable medium, at least some of the instructions being conditionally executable by a processor upon occurrence of a constraint, the method comprising executing instructions by a processor to perform: a) analyzing at least some of the instructions to identify basic blocks and superblocks and to determine the constraints thereof, each basic block containing at least one executable instruction, each superblock containing a plurality of basic blocks, wherein all basic blocks of each superblock require execution whenever any basic block thereof requires execution; b) determining respective weights of superblocks, each weight representative of a number of basic blocks which require execution when the superblock is executed; c) determining the constraints which cause a superblock having a highest weight to be executed; and d) using the determined constraints to generate at least one test case which, upon execution of the program, is capable of causing the high-weighted superblock to be executed, wherein the test case is a first test case, the method further comprising, (e) after performing step (d), determining respective weights of remaining superblocks whose execution is not required when executing the program using the first test case, (f) determining the constraints which cause remaining superblocks to be executed, the remaining superblocks having different weights; and (g) using the constraints determined in step (f) to generate at least one second test case which, upon execution of the program, is capable of causing at least one superblock selected from the remaining superblocks to be executed.