1
votes

I am a newbie in jmeter tool. I want to test login to an asp.net website. But I was not successful after 2 days of search through the internet.

I am listing below the steps that I followed:

  1. Add an HTTP Request Defaults.
  2. Add an HTTP Cookie Manager.
  3. Add two Regular Expression Extractor for EVENTVALIDATION and VIEWSTATE.
  4. Add HTTP URL Re-writing Modifier with ASP.NET_SessionId (checked the Path Extension and Cache Session Id).

    enter image description here

  5. There are two pages, one is Login Get Page and another is Login POST Page. In Login Post Page, I've added the following parameters:

    • UserName : realUser
    • Password : realPassword
    • __VIEWSTATE : name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.+?)"

    enter image description here

    • __EVENTVALIDATION : name="__VIEWSTATE" id="__VIEWSTATE" value="(.+?)"

    enter image description here

    • LoginButton : Log+In
  6. Add a View Results Tree.

I've explored the following links but not successful.

Current Output:

Current Output

What am I missing?
Any suggestion please.

Update:

Test plan tree structure:

Test Plan Tree Structure

Login Details: enter image description here

Login Request Tab: enter image description here

2
What are you getting instead of the expected result?Gavin
I am attaching the expected output as imagesarwar026
@Gavin: According to output image, The login is not successful, any suggestion please?sarwar026

2 Answers

2
votes

Try recording with Jmeter Proxy Server:

Then add all elemnts you described to make what's needed dynamic, except for Http Url rewriting Modifier.

1
votes

We also had these kind of problems getting a login page to work in jmeter. Eventually we got it to work. Important to note is:

  • You have to create two HTTP request samplers for the login page, First one that uses the GET Method. So that the viewstate can be captured by the regular expression extractors, then a 2nd one that uses the POST method that does the login.
  • Use firebug or any other capture tool to capture the Post of your login page, and make sure to add all the controls that post values. If you forget one parameter then your page will give an error. Also the empty ___VIEWSTATE parameter was required for us. See screenshot for our Post request
  • For some pages we also had to add the parameter __VIEWSTATEENCRYPTED with an empty value

screenshot of the login http post request