user3675062
user3675062

Reputation: 51

Could not handle View/state and Event validation in Jmeter Load testing

I am currently load testing a .Net web application. In which scenario is like, user will login and will do certain steps of navigation then he/she will fill one evaluation form, submit it and then logout from the application.

So for this scenario there are many GET and POST request are there. And as its a .Net application server will do some authentication using view-State and _Event-Validation. But to handle that thing I am not sure from which request I need to fetch those 2 Parameter and pass it to which request, as this scenario is a combination of GET and POST requests.Here are the order of requests.

Login (GET) Login (POST) Home (GET) Home (POST) Evaluation (GET) Evaluation (POST) --> It will load list of program according to client name Evaluation (POST) -->It will submit client and Program name to fetch the particular evaluation form Evaluation (GET) Evaluation (POST) Evaluation (GET) Logout (GET)

So guys help me to short this thing out

Upvotes: 0

Views: 3537

Answers (4)

Everest
Everest

Reputation: 51

You can handle it by using Regular Expression Extractor, only you need to pass your view state and Event Validation value from the GET Request to POST Request. And keep it in mind, every POST Request needs a different view state and Event Validation value, that will be fetched from its previous GET Request above it, it will surely help you.

thanks

Upvotes: 0

Dmitri T
Dmitri T

Reputation: 168092

You need to use one of the following PostProcessors in order to extract VIEWSTATE and EVENTVALIDATION values and get them converted to JMeter variables:

See ASP.NET Login Testing with JMeter guide for real-life example and sample configuration of the extractors.

Also don't forget to add HTTP Cookie Manager to your test plan to represent browser cookies, deal with cookie-based authentication and simulate browser session.

Upvotes: 2

Martin Braun
Martin Braun

Reputation: 12599

You can handle dynamic POST parameters between requests in JMeter very easily. For viewstate and eventvalidation, add two regex extractors to your web load test.

Name: Regex Extractor - ViewState
Reference Name: v
Regular Expression: name="__VIEWSTATE" id="__VIEWSTATE" value="(.+?)"
Template: $1$
Match No.(0 for Random): 1

and

Name: Regex Extractor - EventValidation
Reference Name: e
Regular Expression: name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.+?)"
Template: $1$
Match No.(0 for Random): 1

After your recording you have to edit every HTTP Request in your Recording Controller by replacing the values of __VIEWSTATE and __EVENTVALIDATION with ${v} or ${e}.

This will effectively pass the viewstate and eventvalidation of the latest response in your next request.

Upvotes: 3

Imlus
Imlus

Reputation: 57

You should check when view-State and _Event-Validation parameters changes.(you can easily do it with right click and view page source). As these ones identify at which page you are.

In my last script I had 23 different places where viewState changes and I had to extract and change it for 23 times. So no one can answer where you should change them as we do not see the responses and the app you are testing.

Upvotes: 0

Related Questions