Stress / load tests and ajax requests

Stress / load tests and ajax requests

Hi there,

I am using Visual Studio 2010 to record and perform web performance tests (load / stress tests) on Outsystems applications, and I am having trouble figuring out how to parameterize ajax requests.

Visual studio records web requests (not browser events, like for instance Selenium). After a test is recorded, one can parameterize it to perform stress tests. For example, a request to page "MyApplication.aspx?clientId=12345" can be parameterized to extract clientId from a database so that each call executes with a different clientId, during a stress test.

But with ajax requests this is not so simple. I have a lot of ajax requests in my application, so for instance the user can make a search on a sidebar, click one of the result records (ajax request) and the main page is updated. To perform stress tests, I want to simulate the web request of the "click on the search result record", but I want to parameterize it against a database. The problem is: where is the id of the record in the ajax request ?

The recorded request has the following post parameters:


Can I change the clicked record id somewhere in here?

Thank you very much!

Best regards,
Pedro Vieira
Hello Pedro,

I don't think that you'll be able to tamper the ajax request as you're thinking.

Is there a possibility for you to select the record on screen? Just like if it was the user selecting it...

Pedro Cardoso
Hello Pedro,

If you mean simulating the click directly in the page (like what happens when executing Selenium scripts, for instance), this is not possible with Visual Studio webtest's, because they are sequences of webrequests and not simulated browser events.

For now, I will ignore these requests because they do not process the clicked row data, they only redirect to a different page or send back a NotifyWidget message. The important data processing is done on following requests, and on those I can parameterize my data records ID's.

For the future, I see two possible, but not perfect, solutions:

1. Build a few test-only Webscreens that receive the data and execute similar actions to the Ajax requests that we want to test. Problems: extra work needed for development and maintenance; Adds overhead on webscreen rendering that does not happen with a simple ajax request, which will affect test results (time, CPU consumption, etc.)

2. Add an extra attribute to the item being clicked with the id of the clicked record (for instance). This will appear in the generated HTML. Then add some code to the test to read the correspondance between the id of the records and the id of HTML elements, from the generated page. Finally, for each ajax request, add some code to inject the correct id of the HTML element. Problems: Too much work :-), and the result code is dependant on the format of the HTML and ajax requests generated by the Outsystems platform, which may change on future versions.

I'm still looking for a better solution, but what is your opinion on these two?

Best regards,
Pedro Vieira
Hi Pedro,

Just a side question on the testing process: How does the Visual Studio tests handle the variable like the viewstate?
Because they change on each request, so they need to be correctly propagated between posts. I've seen tons of tools (and professional teams especialized in web performance testing) do it wrong and it totally messes up the tests.
Also, one of the situations where I have seen most problems is when there are popups/iframes involved. When that happens the tools usually send the variables recorded on the wrong iframe.

João Rosado
Hello João,

When you record web tests using Visual Studio directly, it uses a plugin for Internet Explorer, and in the end it automatically extracts hidden fields' values from the responses and re-injects them on following requests in the appropriate parameters. If you don't use visual studio to record the tests, you have to do this manually.

I don't know if this works on every situation, but it seems to work on the tests I have been doing over the years on other applications, and also on the Outsystems applications I am testing now.

Best regards,
Pedro Vieira
Hello Pedro,

in fact I was talking about something like Selenium, yes.