How To Calculate Statement
How To Calculate Statement
Statement Coverage: (Find shortest path such that all nodes are covered
at-least once)
o In this, the test case is executed in such a way that every node is
traversed at-least once.
See the below example and understand
Refer diagram.
Branch/Decision Coverage: (Find shortest path such that all the Edges
are covered at-least once)
Test coverage criteria requires enough test cases such that each condition in
a decision takes on all possible outcomes at least once, and each point of
entry to a program or subroutine is invoked at least once. That is, every
branch (decision) taken each way,true and false. It helps in validating all the
branches in the code making sure that no branch leads to abnormal behavior
of the application.
Steps hai kaise solve kare problems ko:-Draw the flow in the following way Nodes(Boxes) represent entries, exits, decisions and each statement of
code.
Edges (Links) represent non-branching and branching links between
nodes.
Example:
Read P
Read Q
IF P+Q > 100 THEN
Print Large
ENDIF
If P > 50 THEN
Print P Large
ENDIF
Calculate statement coverage, branch coverage