Our system implements that the user with out activity for 60 minutes should be logged-out of the system. How do I test this?
- Do i need to test it manually? Wait for 60 mins?
- Is there a tool that I can use?
Our system implements that the user with out activity for 60 minutes should be logged-out of the system. How do I test this?
Two ways available without any tool.
Make the time-out configurable by the tests. In a config-file on the test environment, a setting in a database or passed as a parameter in the API calls. Figure it out, because test-suits should be fast and automated, so there should be value in adding a features to configure it. Make it testable by automation, or get a development team todo it for you.
I am the maintainer of a open-source Chrome extension called Stoppable. It auto blocks websites after a couple of minutes. All the end-to-end Selenium tests set the default value of 5 minutes to two seconds. The whole end-to-end test suite runs in 30 seconds, not minutes. Making it quick to verify all functionality still works and it gives me confidence to release it without any manual testing.
Ask the developer to reduce the session time out timeframe on staging and test environments. Test there.
I don't recommend a 60 minute sleep on selenium. You can also test it once manually. Long delays are difficult for automation to tackle effectively.
If the session is maintained on the server,
a) see if there's a way the developers could create a "forceLogout" API endpoint that your tests can call;
b) If you can, write to wherever the session data is stored (if it's in a database and not just in server memory/cache).
If it's maintained solely through the browser cookies, assuming you're using Selenium, there are methods provided to get, delete, and add cookies (in C# it would be driver.Manage().Cookies.AllCookies
, .GetCookieNamed(name)
, .DeleteCookie(cookie)
or .DeleteCookieNamed(name)
, and .AddCookie(cookie)
). Get whatever cookies maintain the session, alter them to make it look like it expired, delete them from the browser, and re-add the modified ones. Click on something, and the server should say you're logged out and trigger whatever is supposed to happen then.