Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Explain the entrepreneurial process.

Answered: 1 week ago

Question

1. Who should participate and how will participants be recruited?

Answered: 1 week ago