Apache – jMeter – Microsoft ASP.Net – Forms Authentication Page

Background

In this our sophomoric jMeter post opted to go with what is for us a hard choice.

It would have been far easier to go with a web site that does not require authentication, but thankfully we do not trust people enough to have one of those.

And, so here we are ruefully going with a site that requires authentication.

 

Design

Initiate JMeter

Let us start jMeter in design mode.

To start jMeter in design mode we simply issue jmeter.bat from the MS Windows Console

 

Outline

Here are the components that we will be using.

List

  1. Thread Group
    • Session Manager
      • HTTP Cookie Manager
    • HTTP Request
      • HTTP Request Defaults
        • HTTP Request ( initial request of page )
          • CSS / JQuery Extractor
            • CSS / JQuery Extractor ( View State )
            • CSS / JQuery Extractor ( Event Validation )
            • CSS / JQuery Extractor ( View State Generator )
      • HTTP Request ( posting of data to page )
    • Debugging
      • View Results Tree
      • View Results in Table

Image

TestPlan_Outline_20171025_0807AM

 

Designer

Thread Group

Image

HTTP Cookie Manager

Image

Explanation

  1. Initial State
    • Number of Thread :- 1
    • Ramp up speed ( in seconds ) :- 1
    • Loop Count :- 1

HTTP Cookie Manager

Image

Explanation

For session management, we need to keep state and so an HTTP Cookie Manager is required.

HTTP Request Defaults

Image

Explanation

Just a basic HTTP test.

Does not accomplish anything other than to validate connection to website.

 

HTTP Request – Initiate Page Get

Image

HTTPRequestLoginPageGet-20171025-0816AM

Tabulate

  1. Protocol [http] :- http
  2. Server Name or IP :- [servername]
  3. Method :- GET
  4. Path :- /apps/login.aspx
  5. Options :-
    • Redirect Automatically ( not set )
    • Follow Redirects ( set )
    • Use KeepAlive ( set )
    • Use multipart/form-data for POST ( disabled )
    • Browser-compatible headers ( not set )

 

HTTP Request – Initiate Page Get – CSS/JQuery Extractor

Outline

Once we initiate a Page Get Request to our Login Page the web server responds and sends back to us a Login Page.

Using a web browser we access the login page and review the Source HTML

HTML Source

Image

HTTPRequestLoginPageGet-CSSJQueryExtractor-hiddenElements-20171025-1031AM

 

Explanation
  1. The hidden elements includes
    • __VIEWSTATE
    • __VIEWGENERATOR
    • __EVENTVALIDATION

 

CSS / JQuery Expression

Image

HTTPRequestLoginPageGet-CSSJQueryExtractor-viewState-20171025-1049AM

Tabulate

  1. Sample JQuery Expression
    • Expression :- input[id=__VIEWSTATE]
    • Attribute :- value

 

HTTP Request – Initiate Page Get – CSS/JQuery Extractor – “VIEW STATE

Image

HTTPRequestLoginPageGet-CSSJQueryExtractor-viewState-20171025-0913AM

 

Tabulate

  1. Name :- CSS/JQuery Extractor – viewState
  2. Reference Name :- viewState
  3. CSS/JQuery Expression :- input[id=__VIEWSTATE]
  4. Attribute :- value
  5. Match No. ( 0 for random ) :- 1

HTTP Request – Initiate Page Get – CSS/JQuery Extractor – “EVENT VALIDATION

Image

HTTPRequestLoginPageGet-CSSJQueryExtractor-eventValidation-20171025-0945AM

 

Tabulate

  1. Name :- CSS/JQuery Extractor – eventValidation
  2. Reference Name :- viewState
  3. CSS/JQuery Expression :- input[id=__EVENTVALIDATION]
  4. Attribute :- value
  5. Match No. ( 0 for random ) :- 1

HTTP Request – Initiate Page Get – CSS/JQuery Extractor – “ VIEW STATE GENERATOR

Image

HTTPRequestLoginPageGet-CSSJQueryExtractor-viewStateGenerator-20171025-0948AM

 

Tabulate

  1. Name :- CSS/JQuery Extractor – viewStateGenerator
  2. Reference Name :- viewState
  3. CSS/JQuery Expression :- input[id=__VIEWSTATEGENERATOR]
  4. Attribute :- value
  5. Match No. ( 0 for random ) :- 1

HTTP Request – Page Post

Image
HTTPRequestLoginPagePost-20171025-1108AM

Tabulate

  1. Protocol [http] :- http
  2. Server Name or IP :- [servername]
  3. Method :- POST
  4. Path :- /apps/login.aspx
  5. Options :-
    • Redirect Automatically (  unchecked )
    • Follow Redirects (  checked )
    • Use KeepAlive (  checked )
    • Use multipart/form-data for POST ( unchecked )
    • Browser-compatible headers (  unchecked )

HTTP Request – Page Post – Parameters

Image

Tabulated

Name Value Encode Include Equals
txtMemberName dadeniji Checked Checked
txtMemberPassword [password] Checked Checked
btnValidateMember Validate Checked Checked
__VIEWSTATE ${viewState} Checked Checked
__VIEWSTATEGENERATOR ${viewStateGenerator} Checked Checked
__EVENTVALIDATION ${eventValidation} Checked Checked

 

View Results Table

View Results Table – Get

View Results Table – Get – Sampler Result
Image

View Results Table – Get – Request
Image

View Results Table – Get – Response Data
Image

View Results Table – Post

View Results Table – Post – Request
Image

View Results Table – Post – Request
Image
 
View Results Table – Post – Response Data
Image

View Results in Table

Image

Tabulated

Metric Get Post
Start Time 12:01:42.708 12:01:42.789
label Get Post
Sample Time (ms) 74 1833
Bytes 7995 287595
Send Bytes 148 1160
Latency 148 1160
Connect Time (ms) 15 0

 

References

  1. Apache – JMeter
    • Building a web test plan
      Link
    • Apache JMeter HTTP(S) Test Script Recorder
      Link
  2. Mark Schabacker
    • Using JMeter with ASP.NET WebForms Authentication
      Link
  3. BlazeMeter
    • ASP.NET Login Testing with JMeter
      Link
    • How to Debug your Apache JMeter Script
      Link
  4. execute automation
    • ASP.Net WebForms Authentication using JMeter (Series)
      Link
  5. QA
    • Stack Overflow
      • View State value doesn’t get extracted from Request
        Link
      • jmeter Problems getting the _ViewState and _EventValidation parameters
        Link

One thought on “Apache – jMeter – Microsoft ASP.Net – Forms Authentication Page

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s