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

  1. 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:

  1. an array to search
  2. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!