I have a simple task to display a fruit object based on certain conditions. For example, if I need to show a banana I need to make sure the other fruits don’t display.
For simplicity’s sake, let’s say they are 4 possible fruits. Do I need to test all the possible combinations?
Test1 if banana not strawberry
Test2 if banana not apple
Etc.
You need to test as many combinations as there are code paths, for sure. If there’s no strawberry-specific or apple-specific code, then you don’t need to test both banana v. strawberry and banana v. apple. But if there’s different code for a given fruit, you need to test it, as well as one of the others; and if there’s different code based on the number of fruits, then you need to test 0, 1, 2, N-1, N, and N+1, whatever the largest value of N is. In general, you need to test enough to convince yourself additional tests wouldn’t help.