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?
  • 1
    can you not play with this time parameter?
    – Yu Zhang
    Aug 14, 2018 at 8:48
  • That's how I've done this in the past - change the setting from 60 minutes to 60 seconds, and you've saved yourself 59 minutes. Alternatively, if you can't change the parameters, load the application and head out to lunch (or go to a meeting) for an hour.
    – trashpanda
    Aug 14, 2018 at 12:31

4 Answers 4


Two ways available without any tool.

  • Login to your account in the browser and go to browser history and clear the browser history. Then in the loggedin application click on refresh. It will automatically logged out from the application.
  • Inform your developer to reduce the session timeout time for the application to test this scenario.
  • 2
    Why would you want to wait 5 minutes? Seems like a waste of time ;-) Also your first bullet depends on the implementation of the session management and only works for cookie-based sessions, not all API's work like that. We have systems that generate tokens with which you can for some minutes use the API. Aug 14, 2018 at 9:10
  • 1
    Cleaning browser history wil not a) log you out , b) test auto logout after 60 minutes.
    – Embedded
    Jan 31, 2019 at 10:18

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.

  • this is an excellent answer. The actual value of 60 minutes is irrelevant , what is being tested here is that the logout actually happens. It could easily be set to a shorter time for this test to keep it running in CI nicely. For completeness i would also add a full length test but only run at the end of the least frequent regression runs, just incase 60 mins causes some memory or timeout issues elsewhere.
    – Amias
    Feb 4, 2019 at 12:54

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.