What are some test cases for a function that sorts integers?

Hi,

The Function takes an array of integers and sorts it. Without knowing the details of the code, how would you test its functionality?

Questions by luandzai

Showing Answers 1 - 2 of 2 Answers

1. Check the Array size and enter the min-1, min, max_1, max,max+1(BVA)
2. Enter invalid inputs for storing data (Alphanumerics, Special characters, -ve values)
3. Check the I/O Error Messages, Input Messages.
4. Check the Output behaviours.(Sorted or Not)

  Was this answer useful?  Yes

1) You may not know the code, but you can still study the requirements of the program to determine how these integers ought to be sorted.  Things to learn from the requirements:
   a) Is the sort order both lowest to highest AND highest to lowest?  
   b) What is the maximum number of integers this program can sort? 
   c) What is the largest number that the program can accommodate?
   d) In what manner are you to enter the values to be sorted? 
      -Each integer in its own individual text box? 
      -A string of integers separated by commas? 
      -A spreadsheet program?     
2) What sort features exist in this program?  
3) What does the output look like?  

Until I read the requirements, I will assume this program only sorts from lowest to highest value in ascending order.  My test cases are:

Precondition for all test cases
-Input values are unsorted

TC1:  Input 10 valid integers which includes minimum value and verify sort order 
TC2:  Input 10 integers which includes minimum value -1 and verify sort order
TC3:  Input 10 integers which includes minimum value +1 and verify sort order
TC4:  Input 10 valid integers which includes maximum value and verify sort order
TC5:  Input 10 integers which includes maximum value -1 and verify sort order
TC6:  Input 10 integers which includes maximum value +1 and verify sort order
TC7:  Input no integers and submit 
TC8:  Input one valid integer and submit
TC9:  Input maximum number of valid integers and submit
TC10:  Input maximum number of valid integers -1 and submit
TC11:  Input maximum number of valid integers +1 and submit

  

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions