What's a good test oracle for generators
I need to write test cases for a system that generates work cards (a word document that shows how much time an individual has spent on working on different client tasks). The user enters: Monday From 09.00 To 12.00 I was working at ClientSite A From 12.30 To 17.00 I was working at ClientSite B Tuesday From 10.00 To 16.00 I was working at ClientSite A and so on. In the end of the week the system generates a report that shows the total working time/day, the working time for client sites. For Monday the total working time was 07.30h, for Tuesday 06.00h. For the whole week the total working time for ClientSite A was 09.00h. My question is what should I compare the results of the report to? The only thing I can think of is executing some queries against the database to get the needed information, but that pretty much duplicates what the system does. Another way is to keep track of the working times I enter, sum them up and compare them to the actual result - the method I'm going to use. Any other ideas and comments are appreciated.
For this sort of thing you want the ability to enter a set of known data and compare the results against what you would expect the application to output, either at the database or at the GUI. With your example, you'd want to first enter the times into the system by simulating the usual method, and check that the database records match what you'd expect to get if a user entered that information. Then you want to run the report against the data and check that the report returns the correct amounts. The key thing is having the known input data so you can be sure it matches the expected output.