Forum Discussion

stroev's avatar
stroev
Occasional Contributor
9 years ago

Is it possible to parametrize dynamic values in GET Request?

Hi,

I am trying to verify a scenario, in order to execute load test but the verification fails.

I found out that the failure is cause due to a dynamic values in a GET Request. So the verification scenatio fails, due to sending request with the recorded values.

Is there any way or possibility to parametrize the values to get the dynamic values?

I couldn't find it anywhere in the documentation.

  •  Hi stroev,

     

    Yes, you're right that you will need to create some rules in your scenario to make those dynamic values unique on each run. Looking at the screenshot, my guess is that those dynamic values are provided by some previous server response. If so, you will need to correlate rather than parameterize those values. In the correlation process, you will create a data selector for the response that is providing the value you want to capture, then you will use that variable in the GET request.

     

    1. Identify where those values are coming from by using the search bar in the scenario explorer.

     

    2. Select the first request that contains that value and switch to the Response tab. Press the toggle button to view the HTML rather than the rendered view.

     

    3. Select all the text (Ctrl + A) and copy into a text editor like Notepad. Use the text editor's find feature (Ctrl + F) to locate that dynamic value you are looking for.

     

    4. Back in LoadComplete, use a data selector to extract that value. For example, if the dynamic value is in a hidden field, you could use the Data Selector Wizard (right click in the Data Selectors tab > Create data selector with wizard) to "Get an input field value." Otherwise, you can use the wizard's "Get text between two values" option to specify the start and end positions of the value want to extract. When you've created the data selector, be sure to give the variable a name in the "Variable" column.

     

    5. In the request that needs this data, you have a couple options for calling the variable(s) you just created. You could create a data replacer using another regular expression, or you can directly call the variable in the request header.

     

    Please note you may need to replicate this process across several requests, depending on how often those dynamic values are used and whether or not they change from request to request. The search bar will be very useful for identifying where these values are used. Once you have this process working, you may consider creating correlation rules to automate this process going forward.

     

    Hope this helps!

2 Replies

  •  Hi stroev,

     

    Yes, you're right that you will need to create some rules in your scenario to make those dynamic values unique on each run. Looking at the screenshot, my guess is that those dynamic values are provided by some previous server response. If so, you will need to correlate rather than parameterize those values. In the correlation process, you will create a data selector for the response that is providing the value you want to capture, then you will use that variable in the GET request.

     

    1. Identify where those values are coming from by using the search bar in the scenario explorer.

     

    2. Select the first request that contains that value and switch to the Response tab. Press the toggle button to view the HTML rather than the rendered view.

     

    3. Select all the text (Ctrl + A) and copy into a text editor like Notepad. Use the text editor's find feature (Ctrl + F) to locate that dynamic value you are looking for.

     

    4. Back in LoadComplete, use a data selector to extract that value. For example, if the dynamic value is in a hidden field, you could use the Data Selector Wizard (right click in the Data Selectors tab > Create data selector with wizard) to "Get an input field value." Otherwise, you can use the wizard's "Get text between two values" option to specify the start and end positions of the value want to extract. When you've created the data selector, be sure to give the variable a name in the "Variable" column.

     

    5. In the request that needs this data, you have a couple options for calling the variable(s) you just created. You could create a data replacer using another regular expression, or you can directly call the variable in the request header.

     

    Please note you may need to replicate this process across several requests, depending on how often those dynamic values are used and whether or not they change from request to request. The search bar will be very useful for identifying where these values are used. Once you have this process working, you may consider creating correlation rules to automate this process going forward.

     

    Hope this helps!

    • stroev's avatar
      stroev
      Occasional Contributor

      Hi Ryan,

       

      Thank you very very much your reply and your suggestion it helped me a lot. 

      Extracting the values,saving them to variables and calling the in the GET request's fields did work.

       

      Best regards,

      Stoyan.