1

I am currently in a need of a Load test for a web-solution, which requires for a user authentication in Homepage (Welcome Page).

When I seek for the POST SignIn parameters which are passing along with the login credentials using FireBug in FireFox, i found out that Password, TenantName, UserName, __RequestVerificationToken are the parameters which are passing along with their values for a successful login.

I needed to simulate this process using the JMETER.

Therefore i have made a HTTP REQUEST (Visit Login Page) to Navigate to the page using JMETER, which successfully work.

Within the HTTP REQUEST (Visit Login Page) I have added a Regular Expression Extractor, to Extract the token, since it is necessary to pass the token along with the sign in.

  • Reference Name : REQUEST_VERIFICATION_TOKEN
  • Reg Expression : input name="__RequestVerificationToken" type="hidden" value="([A-Za-z0-9+=/-\ _]+?)"
  • Template : $1$
  • Match No. : 1
  • Default Value : (blank)

Regular Expression Extractor

And I have added a separate HTTP Request (Login to Web) for signin along with the Parameters as follows;

  • Password : ${Password}
  • TenantName : ${TenantName}
  • Username : ${Username}
  • __RequestVerificationToken : ${REQUEST_VERIFICATION_TOKEN}

But When I Run it, under the View Results Tree, the Response Data is generating as "The anti-forgery token could not be decrypted..."

When i check for the Request displays under View Result Tree, it displays as

POST data:
Password=123456&TenantName=tenant&Username=admin&__RequestVerificationToken=%24%7BREQUEST_VERIFICATION_TOKEN%7D*

Where in the Request I realized the value for the RequestVerificationToken is not getting initialized.

I was searching for a solution through blogs for two days, where ultimately without a proper assistance I tend to post this question over here.

This is one reference link which is usefully for a extent, from which i used :
http://build-failed.blogspot.com/2012/07/load-testing-aspnet-mvc-part-3-jmeter.html?showComment=1417672985397#c6427302313332055578

Can someone assist me of Why the RequestVerificationToken is not extracting properly, or getting initialized to the variable?

( Ps : please be kind enough to assume that I'm a beginner in JMeter, to be honest, when you are providing your precious reply )

hirosht
  • 932
  • 2
  • 17
  • 31
  • hm..i just noticed... the blog itself has given the correct regular expression..is there any reason you are not using it? – vins Dec 05 '14 at 05:19

1 Answers1

7

In Regular expression '-' has a meaning & it has to be escaped properly if it is expected in your __RequestVerificationToken value.

So, the correct regular expression would be

input name="__RequestVerificationToken" type="hidden" value="([A-Za-z0-9+=/\-\_]+?)"

I created a temp variable & verified above regular expression. It works fine. If it does not work for you, Please provide the HTTP response if possible.

vins
  • 15,030
  • 3
  • 36
  • 47
  • I just check with my question, being honest those few characters have been removed by the stackoverflow due to some HTML syntax probably. Therefore i uploaded a screen shot of my RegEx Extractor. @Vinoth : Will you be able to kindly assist me on it, because regex is correct as it in your example above. but it still passing the error? – hirosht Dec 05 '14 at 10:20
  • Oh!! Then I do not see any issues. Is this possible for you to provide the HTTP response of 'ButtonCloud - visit login page' request? – vins Dec 05 '14 at 14:33
  • @VinothS - I am following same and getting all post data proper in request still it is not logging and giving response code 302 , can you please help? – Helping Hands Sep 07 '15 at 07:26
  • @HelpingHands, Can you please create a separate question with more details? – vins Sep 08 '15 at 15:06
  • 1
    @HelpingHands, glad that you solved it yourself. happy testing – vins Sep 09 '15 at 18:55