Question

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

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

I'm writing these end-to-end tests using Selenium. The only idea I have is the possibility to force the server to use a given date by visiting a URL like /set-fixed-time?time=..., then after the test visit /set-real-time.

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

Was it helpful?

Solution

i think its ok for developer testing however acceptance testing should be done without mock(you could have bug in your mock code). if its has to wait 3 days than acceptance test should wait those tree days or they could by-passed it by changing server time. i think its bad idea to leave back-doors just for testing(some tester could test it by hand and than forget to /set-real-time).

OTHER TIPS

I agree with the Monkey, this is best handled by the developers.

You could also try a hybrid. There's no reason all your acceptance tests have to run on an unaltered simulation of the production site or are only allowed to use the web interface or can't alter things as an admin or can't execute code. You also don't have to change the time of the whole server, which is global and will likely have unintended consequences. You can instead change when the user was last updated.

You can drive Selenium from a program, so a hybrid Selenium and code test could use code to set a user's "when was the last time the updated" data and then execute the Selenium tests to check the outcome. Try it when its never been run, just before time runs out, exactly when time runs out and just after.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top