Dealing with Sessions
Introduction
In certain scenarios, you might want all the steps to be executed in the same session.
But in other scenarios, you might want to clear the session and the cookies before certain steps.
How do sessions work in Endtest
When you execute a Web Test, a real browser is started and the instructions from your test get executed in that browser.
All the test cases from that Web Test will be executed in the same browser session, one after another.
That means that if the test performs a Login in your web application at some point, it will stay logged in until the end of the entire test execution.
After the test execution is completed, the browser and the session get cleared and the data is deleted from the machine on which the test was executed.
How to clear the session
In some scenarios, you might need to clear the session and the cookies.
There are different methods in the Miscellaneous
action that you can use:
- Delete Cookies
- Clear Local Storage
- Clear Session Storage
Sessions for sending API requests
When using the Send API Request action, the API requests do not get sent from the browser.
Those API requests get sent from outside the browser.
That means the session information for those API requests is not stored in the browser.
More details about that are provided in the Sessions and Cookies section from that chapter.
Permanent storage in the Endtest Vault
You may encounter scenarios where a test execution needs to store information that can be retrieved by a different test execution.
For example, one test execution might store a unique value generated by your web application.
And another test execution might need to use that unique value.
This can be achieved by using the Endtest Vault.