# How do I test a ranking system?

Let us assume we have 3 students in a class who have secured the below marks.

```===============================================
|      | Maths  | English  | Science  | Rank  |
|----------------------------------------------
|Mark  |   60   |    40    |    80    |   2   |
|----------------------------------------------
|John  |   40   |    30    |    50    |   3   |
|----------------------------------------------
|Alice |   60   |    60    |    70    |   1   |
===============================================
```

Normally the rank is decided by adding all three marks. Looking at the above table, the rank sequence would be Alice, Mark, John.

If there exists a system that takes student marks as input and lists the student names based on their rank, then how do I test such system whether it returns correct student list or not for all possible data set?

What should be the approach to test such a system? Generating all possible combinations of data would be exhaustive when the number of students and subjects increase.

• this looks like an exam or interview question to me. – Amias Dec 27 '18 at 12:54
• Yes, this could be an interview question as well. Am trying to solve a real use case but modelled the problem to students and marks just for easier explanation and understanding. – Shamanth Dec 28 '18 at 5:54

What should be the approach to test such a system? Generating all possible combinations of data would be exhaustive when the number of students and subjects increase.

You are looking for Equivalence Partitioning Testing - determine representatives entries of infinity sets and test using this non-infinity set of test cases.

For the example above, you can try a cross-space testing between number of students and number of marks:

• 0 students | 0 marks
• 1 student | 1 mark
• 2 students | 2 marks
• a few students | a few marks
• many students | many marks
• too many students | too many marks (trying to create a overflow)

`6 partitions of numbers of students` * `6 partitions of numbers of mark` = `36 test cases`.

• Thanks for the answer. I will explore a bit and get back. – Shamanth Dec 28 '18 at 5:55
• You are welcome - if you found the answer satisfactory, could you mark it as accepted? – João Farias Jan 8 at 19:44

I am quoting myself on an earlier question... how to identify test-cases

There is much information to be found about these problems.

There are tools to generate combinations based on possible inputs, they try to help you to limit the total number but keep a representative 'coverage'. See here: http://www.pairwise.org/ for more information. I have used PICT and Hexawise in the past to generate combinational choices for testing.

If you want to dive deeper into this field, Cem Kaner has published a book about it: The Domain Testing Workbook

Whether it is "enough" is always a choice :-)