Ive got the code I cant quite figure out what needs to be tested, I seem to have
ID: 3746550 • Letter: I
Question
Ive got the code I cant quite figure out what needs to be tested, I seem to have some trouble with testing. Develop a test plan for this method. For actual operational testing, include details on your array(s) under test; size, randomness, generation method. unsorted, nearly sorted and sorted arrays? Design tests to determine if there is a difference between unsorted, nearly sorted and sorted arrays?
class ArraySmallestElement
{
public static void main(String[] args)
{
ArraySmallestElement ob = new ArraySmallestElement();
int[] a = new int[]{ 10, 2, 1 , 4 , 6, 7, 11, 5 };
System.out.println(ob.kSmall(a));
}
public static int kSmall(int[] a)
{ int min = a[0];
for(int i = 1;ia[i]){ min = a[i];
}
}
return min;
}
}
Explanation / Answer
Test Cases:-
Please let me know in case of any clarifications required. Thanks!
Test Case Description Array Size used Array elements The Array contains just 1 element 1 [10] The Array contains no element 0 [] The Array is already sorted 10 [1,2,3,4,5,6,7,8,9,10] The Array is nearly sorted 10 [1,2,3,4,5,6,7,9,10,8] The Array is completely unsorted 10 [4,3,2,1,7,8,5,6,10,9] The Array elements are randomly generated using java.util.Random class 20 The array elements are generated randomly The Array elements are all same 10 [1,1,1,1,1,1,1,1,1,1]Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.