Load Testing with the ANTS scripting language

cmadercmader Posts: 2
edited July 25, 2005 11:21AM in ANTS Load
I created a script using the record feature in ANTS.

To work correctly for our application / test conditions it needs several changes.

1. How can I get the acctuall HTML return by the GET or POST
2. What resources exist to validate the HTML
3. How can I generate an error / resonabley handle errors if we get the worng HTML back from a POST or GET ?
4. How do I extract data from the returned HTML so that I can pass the correct data into the AddPostData commands of the next page?
5. How can I know when I am in the RUN Subroutine which virutal client, or which run in the series I am running?
6. How can I change the user input ( values in the AddPostDataCommands) for each virtual client and / or for each run in a series?

Here are the scenarios that lead up to theses questions.

A. We are testing a customer support application. It is realistic that each customer support person will look up a different customer name, right now the script uses the same name for each of the virtual clients, and for each run in sequence.

B. We have two important values that are returned in hidden input fields on the HTML forms. THese values change each time the page is rendered when a real person in running the application. Currently the script we recored runs with the same values for these hidden fields. This does not produce a realistic load on our database server.

C. During testing the username which our test scripts were using was disabled by a Project Manager -- The scripts still ran -- even though all they were getting back from the POST requests was -- "You are not logged in .. Please Log in", and the resutls page in ANTS LOAD reports really great times -- realisticlly we need to know that each test ended up getting the right HTML back -- and the recorded script seems to assume that the web server always sends back the correct ( and expected) response.

Please feel free to ask for more information if any of my questions, or the scenario's I am trying to address are not clear.

Thank You in advance for you reply.


  • Brian DonahueBrian Donahue Posts: 6,590 New member
    Hello Chuck,

    Thanks for your questions. I can help you with most of these. The body of each web page returned as the result of a GET or POST request is stored in HttpResponse.Content. If you run a method of the webclient such as WebClient.Get or WebClient.Post, the result will be the population of the WebClient.HttpResponse and the Content refers to the actual HTML of the page returned to the client.

    ANTS Load will handle all errors and show them to you in the 'summary information by metric' part of the results. All 400 and 500 errors will appear here and those requests will not be counted in the final statistics. Handing a situation where the page returns a 200, but the content is incorrect, is something that we do not handle automatically. You'd need to write some sort of function that would examine the HttpResponse.Content to make sure it's correct. This sort of functionality is available in many functional testing programs, but ANTS Load, as a load generator, doesn't fall into that category.

    If you're interested in logging the ID of the virtual client, there is a property that you can use: Me.Id. This returns the number of the virtual client, for instance, in a test with 20 virtual users, Me.Id will report a number in the range from 0 to 19.

    To simulate many different users without having to hard code post data for each, you can use the state information feature. Setting up state information is done through the load editor (the State column of the Composition tab), then accessed in the virtual client script by using the Me.StateInformation.Get("Column") function. See State Information in the help file for more info.
This discussion has been closed.