+

Search Tips   |   Advanced Search

  • Previous Topic
  • Next Topic
  • Book Index
  • Create a variable extractor

    In This Section

    1. Review Data extraction method
    2. Create a Virtual User
    3. Understand the problem
    4. Extract contents and assign it to a variable
    5. Use the variable
    6. Related links

    See Also

    1. Design - Dynamic Parameters
    2. Choose a data extraction method
    3. Handle an application dynamic parameters
    4. Submit a form from the previous request
    5. Follow a link from the previous request
    6. Use framework parameters to automatically search for dynamic parameters


    Understand the problem

    The contents of HTML pages generated by your application contain dynamic elements. Typical examples of dynamic content are elements such as HTTP request parameters or links with generated URLs. But in some situations these elements are neither parameters nor links, they are plain HTML elements belonging to the page. Nevertheless you might need to extract these dynamic elements to obtain more realistic scenarios and more thorough test results. You can look at the following excerpt from an HTTP response, containing the result of an account registration feature:

    <HTML> 
       <BODY> 
          <H2>Create an account</H2> 
          <P> 
             <B>Error registering account:</B> 
             <I>The user name you have chosen is already in use.</I> 
          </P> 
          <P>The following suggestions are available:</P>
          <UL> 
             <LI>Suggestion 1: <I>WBrown</I> 
             <LI>Suggestion 2: <I>WilliamBrown_1</I> 
          </UL> 
          <P>Enter another user name and retry</P> 
          <FORM action="index.jsp" method="post"> 
             <INPUT type="text" name="username" /><BR/> 
             <INPUT type="submit" value="Send"> 
          </FORM> 
       </BODY> 
    </HTML>
    

    The HTML page contains text explaining that account registration has failed because the user name provided by the user already existed. The page then suggests alternative user names that the user could use. It finally provides an HTML form for the user to retry creating an account using a different user name, possibly one of the suggested alternatives. If you wanted to define a scenario where the Virtual User selects one of the suggested alternatives, for example the first one in the list for instance, you need to extract WBrown to re-inject it into the request that submits the form.

    In this case, you are going to use a mechanism called the Variable Extractor which extracts arbitrary contents from an HTTP response and assigns the contents to a variable. The variable can then be used anywhere NeoLoad accepts variable values. The extracting mechanism and the way to use the extracted value are the subjects this tutorial mainly addresses.


    Home