0

I am learning TDD and am using Django and Selenium to do some functional testing. I wanted to make it so that a user selects a checkbox that essentially says "add 1 to this number nightly". Then, for all of the users that have this setting on, a nightly process will automatically increment the number on these accounts.

I want to be able to test this functionality in my functional test in selenium, but I don't know how I would go about it. I obviously don't want to wait a day for the test to finish either. Can someone help me think about how I can get started?

skaz
  • 21,962
  • 20
  • 69
  • 98
  • why dont you just change it to fire off minutely instead of nightly? it involves assuming that if it runs every minute it would extrapolate to every 1440 minutes once you change it back, but its easier to test. – TehTris Jun 23 '15 at 17:37

2 Answers2

0

Assuming that time is pulled from the OS and that your "nightly" operations are based on that time, you could change the OS time to seconds before the trigger time for the function.

You can take a look here for how to change the OS time from python: Python module to change system date and time

Flow would be something like: init test > change flag on the user account > change system time > wait for the action time to elapse > check expected output for the user > and return system time to actual time.

Community
  • 1
  • 1
Justin Andrew
  • 242
  • 1
  • 10
0

I've decided that I am just going to call the method of the nightly methods directly, instead of making a truly functional test.

skaz
  • 21,962
  • 20
  • 69
  • 98