问题
I have tried with regular expression also with css/j query extractor,not able to run my script properly. My exact test scenario is kind of
- There is kind of application form.
- First Load the page.
- Fill with some data, then go to next page.
- Now again fill some details, and Submit.
Note:For Each and every 'application form' there is two "9" digit unique number , which gets generated from server side, and after participating the form there is two options:
a)Access Count
b)Response Count
Every time J meter thread group hits the page 'Access count' properly gets increased , but Response Count not gets change, it should get increase for each user as well.
I have tries to correlate both the parameter using regular expression and css/j query expression , but still the 'Response Count' not gets increment. What should I do for this case to do Load test in J meter.
Viewstate regular expression
Change parameter
Regular Expression: input[id=_VIEWSTATE]
While Checking the response data in
result tree its showing different in Load page and next Page.
回答1:
- Add Regular Expression Extractor as a child of the first request.
Configure it as follows:
- Reference Name: VIEWSTATE
- Regular Expression:
<input type="hidden" name="javax\.faces\.ViewState" id="javax\.faces\.ViewState" value="([^"]+)".*/>
- Template:
$1$
- Refer extracted value as
${VIEWSTATE}
where required.
By the way, you can test your Regular Expressions right in View Results Tree listener using RegExp Tester view.
回答2:
The regular expression is wrong. input[id=_VIEWSTATE] can' t capture a value. You can test it in regular expression tester of response.
It may be something like: input[id=(.*?)] It depends on your dynamic value. But in question you didnt mention screenshot of that dyanamic data.
来源:https://stackoverflow.com/questions/35721769/regular-expressionn-not-able-to-correlate-my-test-scenario-with-viewsate-in-jmet