问题
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
回答1:
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.
回答2:
You need to use one of the following PostProcessors in order to extract VIEWSTATE and EVENTVALIDATION values and get them converted to JMeter variables:
- Regular Expression Extractor
- CSS/JQuery Extractor
- XPath Extractor
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.
回答3:
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.
来源:https://stackoverflow.com/questions/33030823/could-not-handle-view-state-and-event-validation-in-jmeter-load-testing