How to check functionally that something should happen at the moment?

I am writing a web application that contains a kind of schedule. After a certain action, the schedule is updated and when the user visits the page on that day, something happens.

Any ideas on how to write a functional (acceptance) test for this kind of functionality?

I am writing these end-to-end tests using Selenium. The only idea I have is the ability to force the server to use a given date by visiting the url, for example /set-fixed-time?time=...

, and then after a test visit /set-real-time

.

On the server, I would use a custom object to get the current time and that object will be replaced when one of the urls is visited.

0


a source to share


2 answers


I think this is ok for developer testing, however acceptance testing should be done without mocking (you may have a bug in your mocking code). if it has to wait 3 days than the acceptance test has to wait for those tree days or they could bypass it by changing the server time. i think its a bad idea to leave the back doors just for testing (some tester might check it manually and then forget / set in real time).



+2


a source


I agree with Monkey, this is best for developers to decide.

You can also try a hybrid. There is no reason why all of your acceptance tests should run on an unmodified simulation of the production site, or they are allowed to use the web interface, or they cannot change things as an administrator, or they cannot execute code. You also don't need to change the time of the entire server, which is global and will probably have unintended consequences. Instead, you can change when the user was last updated.



You can control Selenium from within a program, so a Selenium / code hybrid test can use the code to set by the user "when was last updated" and then run Selenium tests to verify the result. Try when it never starts, just before the time runs out, exactly when the time runs out and just after.

0


a source







All Articles