Question
SOFTWARE TESTING: statement test criterion & branch-condition test criterion Given the following method in Java... /** Returns the subset of ints that are greater than
SOFTWARE TESTING: statement test criterion & branch-condition test criterion
- Given the following method in Java...
/**
- Returns the subset of ints that are greater than the provided
- target value
- @param a : an array of ints to search
- @param target : the value to search for
- @return the subset
*/
public static int[] greaterThan(int[] a, int target) {
List found = new ArrayList<>();
if (a != null && a.length > 0) { for (int i=0; i < a.length; i++) {
if (a[i] > target) {
found.add(a[i]);
}
}
return found.stream().mapToInt(Integer::intValue).toArray();
}
throw new IllegalArgumentException("Input array is null or empty");
}
1. Design a test suite with the fewest number of test cases that satisfies the statement test criterion.
Define the test suite as one or more literal arrays:
T1 = [x, y, ], n
where the values in the array are actual integer values. [] can be used to indicate an empty array. The word null by itself (not inside brackets) can be used to indicate null.
Notice that a test case requires 2 values:
- an array to search
- an int to search for
2. Design a test suite with the fewest number of test cases that satisfies the branch-condition test criterion. Define this test suite using the same technique as above
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started