In: Computer Science
Given are the following low-level requirements:
LL10.3
IF( ((numberOfSatellites < 4) AND ( receiverFlag = TRUE))
|| ((numberOfSatellites >= 4) AND (receiverFlag = FALSE)) )
WriteErrorMessage()
ELSE
IF( timeOfWeek > 0)
ComputePosition()
ENDIF
Suppose this low-level requirement is implemented as follows:
if( ( (numberOfSatellites < 4) && (receiverFlag == TRUE) ) || (
(numberOfSatellites >= 4) && (receiverFlag == FALSE) ) )
{
WriteErrorMessage();
} else if (timeOfWeek > 0)
{ ComputePosition(); }
How many tests are required to achieve (explain your answer and give the test cases)
: a) Statement Coverage
b) Condition Coverage
c) Decision/Condition Coverage
d) Multiple Decision/Condition Coverage
e) Modified Condition/Decision Coverage
Give examples of a set of test cases that would achieve MC/DC.
STATEMENT COVERAGE
We require a minimum of 2 test cases to run every statement.
1. numberOfSatellites = 3, receiverFlag = TRUE
2. numberOfSatellites = 5, receiverFlag = TRUE, timeOfWeek = 2
CONDITION COVERAGE
Here, each condition takes all possible outcomes at least once. Hence we require a minimum of 4 test cases.
1. numberOfSatellites = 3, receiverFlag = TRUE
2. numberOfSatellites = 3, receiverFlag = FALSE , timeOfWeek = 2
3. numberOfSatellites = 5, receiverFlag = FALSE
4. numberOfSatellites = 5, receiverFlag = TRUE, timeOfWeek = 0
DECISION / CONDITION COVERAGE
We require a minimum of 6 test cases.
1. numberOfSatellites = 3, receiverFlag = TRUE
2. numberOfSatellites = 3, receiverFlag = FALSE , timeOfWeek = 2
3. numberOfSatellites = 5, receiverFlag = FALSE
4. numberOfSatellites = 5, receiverFlag = TRUE, timeOfWeek = 2
5. numberOfSatellites = 3, receiverFlag = FALSE , timeOfWeek = 0
6. numberOfSatellites = 5, receiverFlag = TRUE, timeOfWeek = 0
MULTIPLE DECISION / CONDITION COVERAGE
Same as decision /condition coverage.
MODIFIED DECISION / CONDITION COVERAGE
We require a minimum of 6 test cases.
1. numberOfSatellites = 3, receiverFlag = TRUE
2. numberOfSatellites = 3, receiverFlag = FALSE , timeOfWeek = 2
3. numberOfSatellites = 5, receiverFlag = FALSE
4. numberOfSatellites = 5, receiverFlag = TRUE, timeOfWeek = 2
5. numberOfSatellites = 3, receiverFlag = FALSE , timeOfWeek = 0
6. numberOfSatellites = 5, receiverFlag = TRUE, timeOfWeek = 0