I'm maintaining and testing a web-based timekeeping system written in Java. (It's a small IT shop, so I'm the only person working on it.) Employees use the system to enter the hours they've worked, request time off, etc.
I'm using Microsoft Test Manager to do some manual testing, but I'd like to automate it. Unfortunately, I'm running into a problem because of testing scenarios like this:
- Employee submits a request for time off on a certain date.
- Supervisor approves the time off request.
- Employee submits the timecard that reflects the absence on that date.
Automating this test presents me with 2 problems:
When I want to repeat the test, entering the same date for the absence will fail validation, because the absence occurred in the past and that timecard has already been submitted. I suspect the best solution is to backup the test database, then restore it before each test. Is there an easier way?
The validation code checks the current date and responds differently depending on when the requested absence is. For example, asking for time off next week is fine. Asking for time off way in the future results in a warning. Asking for time off way in the past is rejected. Is there a good way to handle this?