Forum Discussion

Moser's avatar
Moser
New Contributor
3 years ago

How to stop project level variables getting overridden during a load test in READYAPI

Below is a functional test under a READYAPI Project:

 

REST Request (Application Home page)1 - when fired would produce some response, we captured the XSRF-TOKEN and assigned to a project level variable “xsrf-token-from-home-page”

REST Request (Login) 2 – Will be fired with the XSRF-TOKEN(xsrf-token-from-home-page) as a Request Header. Would produce some response, we captured the XSRF-TOKEN and assigned to a project level variable “xsrf-token-from-login-page”

….,,,

….,,

REST Request (Logout) – Will be fired with XSRF-TOKEN captured from the previous request/response.

 

 

Problem:

When I created a Load Test for the above and ran a test with 2 VU’s (Simultaneous) – I saw the project level variable is getting overridden by both the VU’s at the same time and 1 of the requests for 1 VU is failing and then all the remaining requests are failing to login to the application. In the end we are seeing failures with the load test.

Do we have any feature or option to handle this situation?

  • Hello Moser 

     

    At first glance without knowing all the details of your testcase structure, I would suggest not saving project level variable but use a testcase level variable instead.  At project level any VU will be updating content that another VU might be relying on.  Keeping all the data separate that a VU will use should be your goal.

     

    Regards,

    Todd

  • TNeuschwanger's avatar
    TNeuschwanger
    Champion Level 1

    Hello Moser 

     

    At first glance without knowing all the details of your testcase structure, I would suggest not saving project level variable but use a testcase level variable instead.  At project level any VU will be updating content that another VU might be relying on.  Keeping all the data separate that a VU will use should be your goal.

     

    Regards,

    Todd

  • Moser's avatar
    Moser
    New Contributor

    Hello TNeuschwanger ,

    It did work as expected after making changes with the variable to test case level.

    Still wondering, how it is making difference with the load test and keeping the variable values for each VU's.

     

    Thank you