May 21st, 2011
Suppose there is an automated test case for a report:
1. Generate a report for today 2. Check if the date printed on the report is today's date
The question is: how can this test case fail?
The obvious answers may include:
- The report is not generated
- The date is in the wrong format
- The date filed contains an incorrect date
Let’s focus on the last situation. What does it mean if the date is incorrect? The answer is not always “there is a product bug that prints an incorrect date on the report”. It can also mean that there is a test issue… Below an example of execution (with timestamps) that triggers a test bug:
[23:59:46 May 1] 1. Generate a report for today [00:00:04 May 2] 2. Check if the date printed on the report is today's date
The report was generated on May 1st but the date check against “today”‘s date happened on May 2nd. The test fails though the report is correct => test bug.
How do you mitigate this?
PS: That’s a test case that I wrote for one of the features in AX2012. It has been executed almost daily and it failed, for the first time, after 3 months.