date/time driven automated test cases
Many of our test cases have to incorporate change date in order to reproduce different types scenarios (e.g. users does action1/verification1 on day1 , user does action2/verification2 on day2, scheduled job runs on day3 and does something to user/verification3). Our product infrastructure consists of different application servers(microsevices architecture). So what we currently do is basically move the date forward to all application servers at the same time so everything is in sync and proceed with actions/verifications ( simply ssh to each server and change date). However this, sometimes is causing issues with the scheduling mechanism which runs the daily jobs. They sometimes runs and sometimes don't, leading to false negative scenarios which overall is a bad thing for an automation test suit since you always get random failures and you are unable to deliver a solid report.
Product team says that , if you guys(QA) want to change dates while running tests , we cannot guarantee the correct behaviour and stabilty of the entire system. Which is acceptable since you don't expect this kind of behaviour on a production environment and you dev team is not obliged to support something like that. We say that we cannot basically automate time driven scenarios if the application is not stable. As I said the entire infrastructure consists of many different modules , queuing systems , DBs etc. Overall the date change mechanism across the entire system appears to be working but it is not stable. I'm trying to find another way of implementing or even simulating date change so we can do our tests and basically produce solid reporting and realistic test data after the daily execution. Have you got anything in mind ?
Generally testing date is done at a unit level. At that level, time and sequencing of the test can be precisely controlled using dependency injection.
Originally Posted by atomsk
As for testing scheduling, it's best to ask the developer to add some dashboard or api call that allows you to trigger the tasks. Entries you can backdate using a DB queries.