One of the criteria for covering program logic (and testing method) (that is stronger than statement coverage which is actually the weakest one) is decision or branch coverage, or even all-edges coverage. According to this criterion, you need to write a sufficient number of tests so that each decision can take the value True and False at least once.
Put it another way, it is required to execute each branch direction though once. Examples of branch or decision statements are the while or if statements.
It can be shown that decision coverage usually satisfies a statement-coverage criterion. Since each statement lies in some path that originates either from the entry point of the program or from a branch statement, then when executing each branch direction each statement must be executed. But, there are leasewise three exceptions.
- The first is a pathological situation when the program has no decisions.
- The second is found in programs or subroutines with several entry points (for example, in assembly language programs); this statement can be executed only if the run of the program begins with the corresponding entry point.
- The third exception has to do with the statements inside the switch statements; the execution of the branch in each direction does not necessarily trigger the execution of all test cases.
By the way, ecommerce testing services can be used to attract more visitors to any Website by enhancing its performance, usability and security.
Since statement coverage is considered a pre-requisite, decision coverage, which appears to be a stronger criterion, should include statement coverage.Therefore, decision coverage requires that each decision takes the values True and False, and each statement is executed at least once.
An easier and alternative way of expressing this requirement is that each decision has values True and False and that each entry point (including every test case) must receive control at the call of the program at least once.
The foregoing assumes only two-valued decisions or branches must be modified for programs containing polysemantic decision (as with test cases). The criterion for them is the execution of every possible branch from every decision point, at least once, and the delegation of control when the program or subroutine is called at each entry point, at least once.
Comments are closed.