Manage cookies

The API Engine handles cookies automatically. If the API Engine receives a cookie, it stores the cookie in memory and sends it in the subsequent request message. After execution, the API Engine deletes all stored cookies.

The API Engine stores cookies in the Resource CookieTable. If you want to analyze and/or save cookies, access this resource via the Details tab.

CookieTable in the Details tab

The XTestStep Save file Resource allows you to save cookies in a .txt file when you execute your TestCase. The generated XTestStepValue Filepath specifies where the system saves the file.

The XTestStep Evaluate XPath displays detailed cookie information, such as the domain and time stamp.

If the Module or TestCase specifies a cookie that is already stored in the CookieTable resource, the system uses the cookie from the resource.

If the Module or TestCase specifies a cookie that is not stored in the CookieTable resource, the system adds the new cookie to the resource.

Disable automatic cookie management

The API Engine handles cookies automatically. However, you can disable automatic cookie management if your TestCase requires it.

In this case, the cookies are not stored in memory for subsequent requests. The API Engine has to contact the service for each API call that requires a cookie.

To disable automatic cookie handling, set the test configuration parameter (TCP) AutoSetCookies to False.

You can set this TCP for TestCases that you want to execute and in ScratchBook for trial runs of your TestCases.

Keep cookies after execution

By default, the API Engine deletes cookies after each execution. However, you can disable the automatic deletion of cookies if your TestCase requires it.

For instance, you might steer an API where some TestSteps fetch cookies which you need to create and run subsequent TestSteps. If the API Engine deletes all cookies after each execution of the cookie-fetching TestSteps, you cannot run the subsequent TestSteps that depend on these cookies individually. You would have to execute all of the TestSteps in one run.

To avoid this, you can create the test configuration parameter (TCP) FlushCookies and set it to False.

You can set this TCP for TestCases that you want to execute and in ScratchBook for trial runs of an individual or all TestCases.

FlushCookies TCP in Scratchbook