WAPT usage

Variables and parameters

In the previous post I demonstrated how to parameterize a simple profile. That profile consisted of only three requests. First request opened the main page of a web forum with sub-forums listed on it. Second request opened one of the sub-forums. Third one opened a topic inside that sub-forum.

The goal of the parameterization was to make WAPT open a random sub-forum on the second step and a random topic on the last step. Initially both were recorded as constant values.

The main idea was that when we want the value of a certain request parameter to be dynamic, we can use special functions to extract it from server response to the previous request. While this worked perfectly for our simple example, this does not seem to be a general way to handle such situations. What if the required value is contained in the response to, say, 5th request of a profile, and it should be used in the 10th request?

The answer is: we can extract that value to an internal variable and then use that variable in any subsequent request. I mentioned this mechanism before when I wrote about extracting values from hidden controls in HTML forms. Now I am going to show how to do this with other values.

I will continue using the same example and will simply change the parameterization. Basically I will use the same “Search” function that finds a value surrounded by two boundaries, but this time I will extract that value to a variable.

I select the first request in the left view and the “Response processing” tab in the right view. This tab specifies what WAPT should do with the server response to the selected request during the testing. The most important thing here is the definition of variables. The list of variables is shown at the top of the page. Initially it contains only values of hidden form controls for which the variables are created automatically.

Initial list of variables

Now let’s add a new variable for the number of sub-forum. I click the “Add…” button near the variables list. The “Add variable” dialog is displayed.

Add variable dialog

This dialog is very similar to the “Edit parameter” dialog that is used to specify how to calculate the value of a parameter. Actually, sometimes people even mess parameters of a request and WAPT internal variables. Even though both things are specified in a very similar way, they are completely different in meaning. The variables are used to store values during a user session. It is a very common practice to extract a value into a variable and then assign the value of that variable to a parameter of a subsequent request. This is exactly what we want to do now.

I specify the name for our new variable and click the “Add” button to add an extraction function. This will be the “Search parameter” function specified as follows.

Extracting a value into a variable

I use the same right and left boundaries that we used before.

Now I need to specify how to use the created variable. I select the second request in the left view. We need to change its showforum parameter. I click the “Edit” button to open the “Edit parameter” dialog, and one more “Edit” button inside it to open the “Edit function” dialog. Here I select “Variable” for the function type and click the “Select…” button near the variable name. I could simply type the variable name, but this dialog provides a more convenient way.

Assigning a variable

By the way, note the Session_number variable. It is always present in the list and contains the number of the current user session starting from 0. It is very useful sometimes, if you need to have some unique value for each user session.

Basically that is all. We can repeat the whole procedure for the topic number in the third request and verify the test. If we do everything correctly, the verification log will be absolutely the same as before.

So, in short: when we need to use a value contained in the latest server response, we can extract it directly to a parameter. However if we need to use an “older” response, we have to create a variable in the processing of that response and extract the value to that variable. Only after that we can use it in subsequent requests.
Why is this important? In old days all page requests inside user sessions were created by users clicking links and buttons on the web pages. In such case you would never need to extract data from “old” responses, because the only content available for the browser at the moment of sending next request was the current page. So, any data included in the request could have been taken either from current page or from direct user input.

That was simple… But then they invented JavaScript and AJAX. Now while you are browsing a page containing AJAX, your browser can send additional requests to the server and receive additional data from it to update the current page without fully reloading it. As a result, the page that you see when sending the next request actually contains data received in several server responses, so you need to have a way to extract values from any of them.

37 Comments

  1. Nickole Churape

    Great Post!! Thank you very much!

    • For our situation we need a WAPT test ( containing 2 profiles ) to run against the same web site but on different environments ( unix-apache, windows-iis ) so that we can compare the performance of both.

      However I can’t seem to find an intuative way on how to make the host part of the URL ( e.g. http://www.mydomain.com ) used for all http requests variable to be reused by the profile.

      This will be useful so that we can simply load the WAPT test on the new environment, change that host variable and we can run the same test again without all the hassle of going trough all the page requests.

      Can you please point me into the right direction on how to do that?

      • Sergei Leonov

        You can use Find and Replace command from Edit menu to replace a server name for entire profile. Or you can create initial variable on profile properties page and use its value as server name for each page request.

  2. Javier Ricardo Charry

    Thank you very much!

  3. Nelson Hash

    This website has greatly helped me. I will visit again. The tips written here are amazing. Please update this site with new details.

  4. Hi,

    I see change parameter value for each session/users for order list and random list. Is there any way to select next value from csv file for each occurrence, its useful if i have to iterate a parameter value in a loop so that it select unique value for every loop iteration.

  5. One more feature to check the box to avoid think time while verifying the test profile.

  6. can WAPT be used for testing on Oracle

    • Yes, in most cases you can use WAPT to test Oracle products. The only exception is the old version of Oracle Forms that has binary data inside requests and responses. You are welcome to contact us to suggest on your specific case.

  7. HI Ivan,

    Could you please explain detail about think time for each request?

    Also I want to execute multiple profiles at a time for below settings;

    Ramp up load: from 0 to 5 users with step 1 to every 10 sec.

    Run time: 10 min
    Delay: 2sec

    Duration by profile.

    So please suggest me How to create the good traffic on my website using valid settings

    • Hello Manjunath,

      Think time emulates time that user spends reading the page. In other words, this is a delay between requests. If you change it, you can make your profile execute faster or slower. It is recommended to use initially recorded think times.

      If you want to run test with several profiles, you can do this. As for the proper load, it depends on your test goals, so there is no general recommendation on this. Try starting with small number of users and increase it to see how the site performance parameters are affected.

      Regards,
      Ivan

  8. How can I write the value of a response body variable into a .txt or .csv file ? This way will help me to read the value while passing parameter for a different profile.

  9. Hi Ivan,

    How can I parameterize a “radio” type input in WAPT?
    If the code is somthing like:

    The option chosen using a radio button, will be used through out my session.

    Please suggest me how to parameterize if input type is “radio”.

  10. The Code is something like this:
    input type=”radio” value=”XXX” name=”YYY” onClick=”javascript:storeSelectedYYY(‘XXX’)

    • Hello Ravi,

      As I understand, you want different virtual users to use different options selected by these radio buttons.

      If so, the most simple way is to have a predefined list of all selections. You can use the “Ordered list” function to pick values from it.

      If the options in selection are different in different sessions, you may need to apply a more complex approach and extract the list of options from the page for further processing. It can be done with help of JavaScript.

      Regards,
      Ivan

  11. Hi,

    I have recorded script
    In response body it display the code in Hexadecimal format;
    Ex:
    504B0304140000000800B439914335C

    so I am not able to find Dynamic value,

    Tell me what should i do

  12. Dear Ivan,

    I have a form titled “Vendor Master” in my application and i want 100 of vendor entered by 10 different user how it can be done through WAPT tool.
    Please let me know the profile scenario and do tell me how to apply conditional statement in WAPT script.

    Regards,
    Virendra

    • Hello Virendra,

      As I understand, you need to emulate 100 sessions with different input values, but use only 10 user accounts. You can create a CSV file with the following columns:

      username password form_data

      In each session you can read one line with help of the $CSV function. Different lines in CSV file can contain same username, if you want same user to fill several forms.

      Conditional statements work the same way as in any programming language: they check the specified condition. If it is true, one set of actions is executed. Otherwise another set is executed.

      Regards,
      Ivan

  13. sneha khatana

    hi, i am a beginner in Performance testing. Can u help me related to correlation part incase of WebLoad Tool

  14. Hello, im trying to do stress testing with different 100 user.

    After i record my scenerio, i can not see any parameter on response processing tab, or in the page’s post parameters.

    I can see the values like name, surname in the post method of the text type. How can i return that values as a parameter?

    Thank you

    • Hello,

      You can insert variable values inside the body of POST requests by typing “$Var(variable_name)”. You should assign the “variable_name” variable in the processing of a previous request or in the “initial variables” section.

      If you have any further questions on this, please send your virtual user profile (.wpp file) to support@loadtestingtool.com.

      Regards,
      Ivan

  15. Hi,

    How can I edit already created variable. I also need to see what search criteria(boundaries) was used before I change existing search criteria.

    Thank you

    • Hello,

      Select the variable in the list and click the “Edit” button. This will open a dialog where you can specify the way the value is assigned.

      Regards,
      Ivan

      • Hi Ivan,

        Thanks for your reply.

        Sorry I was not specific before.

        I have created a variable of type ‘Search Parameter’, now want to edit this same variable. On ‘Edit Parameter’ popup window I click on ‘Edit’ button which opens ‘Edit Function’ screen but on this screen there is no way that I can edit this same variable (I mean change current search criteria)

        Is it possible to change search parameters of the current variable?

        Regards

        • Hello Vivek,

          Variable value is calculated from concatenation of several functions. In most cases only one function is used. The list of functions is shown in the “Edit Variable” dialog. You should click the “Edit” button in it to edit the function parameters. This will open another dialog.

          If you have further questions, please send an email to support@loadtestingtool.com. You are welcome to add screenshots and test files (.wpp and logs) to illustrate your questions.

          Regards,
          Ivan

        • Hi Ivan,

          Please ignore above, I have found from where I can edit variable.

          Thanks

  16. Hi,

    When using csv function, is it possible to parameterise root path for the csv file name?

    I tried creating static test variable and use as root path for file like below but it did not work,

    e.g. I created static text variable CSVLOC to store root path E:\testdata\
    and used as
    $Var(CSVLOC)\mytestcsv.csv as name.

    Thanks

    • Hello,

      It is not possible to parameterize the file name. Note that this would mean that the file may change during the test, which is not acceptable, because a new file would need to be transferred to all load agents in order to execute the test properly.

      Regards,
      Ivan

  17. Ameen Abusaif

    Hi Ivan,
    Honestly i have a lot of questions but mainly, when i verify my test many of pages does not retrieve a variables that is necessary to be changed every time running the test to be Parameterized in the response field .
    maybe my question is not clear i did not received the idea yet.

    thanks.

    • Hello Ameen,

      Most probably something went wrong in the user session before the requests you mentioned. For this reason the responses did not contain the values. Check the verification log to see the details. If you are still unsure about the reason of the problem, please send the profile (.wpp file) and the log to support@loadtestingtool.com.

      Regards,
      Ivan

Leave a Comment

Your email address will not be published. Required fields are marked *

*