Question: White Box Testing Scenario: Given an array of no more than 1 0 0 unique integers sorted in ascending order, arr, and an integer x
White Box Testing Scenario:
Given an array of no more than unique integers sorted in ascending order, arr, and an integer x the function returns an integer that meets the following conditions:
If there is no such a value of j that arrj equals x then return
Otherwise, return the value of j that arrj equals x
The function throws an Exception for any invalid input, eg arr is null, or x is not an integer.
Suppose we have already had implementations of the above function Iterative Binary Search Algorithm in different programming languages.
Solely based on the source code, can you design test cases using Java or Python language of the binarySearch function by applying each of the following white box testing methods?
Statement Coverage
Decision Coverage
Loop Coverage
Path Coverage
Statement Coverage
Test cases do not miss any statement in the coverage; No redundant test cases.
Decision Coverage
Test cases do not miss any decisions in the coverage; No redundant test cases.
Loop Coverage
Test cases do not miss any loop cases in the coverage; No redundant test cases.
Path Coverage
Test cases do not miss any path in the coverage; No redundant test cases.
Decision Coverage
Please indicate which language version of source code you are using JavaPython
Identify all sides of every decision point, and the inputs that result in each decision side:
Use the following template:
ID Decision arr input x input
D if y true
D if y false
List the tests you designed to cover the decisions in the above table. Test cases might be fewer than the decisions.
Test Decisions covered arr input x input output
T D D
T
Loop Coverage
a Please indicate which language version of source code you are using JavaPython
b Identify different cases for the loop structure, design inputs to result in each case, and finally, figure out the expected output for each input.
Use the following template:
Test Loop body arr input x input Output
T zero times
T once
Path Coverage
a Please indicate which language version of source code you are using JavaPython
b Identify all possible paths:
Use the following template:
Path Line# in the path
PT
PT
List the test cases you designed to cover all the identified paths:
Use the following template:
Test Paths covered by test arr input x input Output
T PT
T PT PT
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
