user3517780
user3517780

Reputation: 1

Running automated test for 24 hours with robot framework and selenium2library on jenkins

I have a test case for activation account which have 2 scenarios.

  1. First TC is where user creates an account and gets activation link in email and he goes to email and clicks on the link and his account is activated.

  2. The other TC is wherein i have to check the case where the link is dead after 24 hours. Now i am using selenium2library and robotframework for my test cases.

I am not able to find a way for second TC wherein i have to pause the running of TC for 24 hours before making a call to email and get the expired link. I tried going to DB and changing the timestamp of the link by -24 hours but touching DB while running TC is not a good option.

Does anyone knows a workaround for this? Is there any selenium2keyword etc to achieve this?

Upvotes: 0

Views: 767

Answers (2)

Bryan Oakley
Bryan Oakley

Reputation: 386342

For testing purposes, would it be possible to set the expiration time of the link to something more testable, such as five minutes? It should be reasonable to assume that if it is configured to expire in five minutes and it does, then if it is configured for twenty-four hours it will, too.

Of course, you would definitely want to follow this test up with a manual check at some point. Proper testing doesn't require 100% automation. Some tests are best left to humans at a keyboard.

Upvotes: 0

Dan Snell
Dan Snell

Reputation: 2245

I think I would actually look to break down your scenario into a few different cases and determine the best way to approach each case.

TC1. Create new account and get activation link - Maybe selenium? I would actually prefer if possible to do this via and api or database call if that is where the real logic is. Then I would look to capture the URL before it is even sent out by email. It would be particularly helpful is this was a return value from an API or a value in the db. Otherwise if you end up having to go through the hassle of logging into an email system and getting it from there. The verification on this is that the URL is generated.

TC2. Setup a new account or use an existing account / URL pair that has been reset to an "pre activation" state. If you use Selenium here there is no real need for a mouse click event. Simply navigate to the URL ie (driver.get("myactivationURL")). You can then verify either in the UI a successful activation or query the db that the activation is successful.

TC3. You could do an A and B for this. One with and activated account and one with a non activated account with timestamp older than 24 hours. Verify that in both cases if the activation link is sent it gives the proper messaging and the values in the db are still correct depending on the previous state of the account.

This would be faster and more reliable than trying to wait 24 hours during the running of one long test. It would also mean you could test discrete parts of the process.

Upvotes: 3

Related Questions