Thursday, November 1, 2012

Test cases for overlap of rectangles

Given a function, func( rect a, rect b), which takes two rectangles as argument and tells if two rectangles overlap or not. Write all possible test cases for this.

Strategy:

This is a testing profile question asked by Microsoft in 2011. If you are being hired for testing profile you will face many such questions which aim at testing your ability to come up with interesting and unique test cases. You should think out of the box to suggest situations which can cause the function or a component to fail. If function responds correctly to all the cases, it is considered fit to be used.
Coming back to the question at hand, let's write all the test cases:
  1. Begin with the base cases i.e. putting NULL in place of either a, b or both. That means function must not fail if either of the arguments is empty. This is generally the case, since developers sometimes forget to keep check for this.
Next all the test cases are given with diagrams to make it easy to understand.
Test cases Test
cases
These are few test cases, there can be many more to this. But keep in mind to give the base or initial test case. That is from where interviewer judges your understanding and method you tackle the problem.

No comments:

Post a Comment