Skip to Content

Content this document is based on:

As you can see from the above content, jMeter allows to load test a WDJ application. But how do you create the jMeter tests? A test consists of several browser request to the application, submitting data, headers, cookies, etc. It’s not feasible to add all request manually. Therefore, jMeter comes with a reverse proxy that intercepts the browser requests and uses them to create the tests. Short: jMeter records every interaction between the browser and the server. This also means that when you use Internet Explorer to record the test, jMeter will act as Internet Explorer to the server when running the test. To test with different browsers, it makes sense to record the test with each browser.

To record browser navigation, add a proxy and configure it accordingly.

/wp-content/uploads/2013/08/recwdj1_262512.jpg

Important: URL Patterns to Exclude

Depends on what you want to test: the application only or also the impact of loading HTML resources like CSS and Javascript. Patterns to just test the application:

  • .*\.css.*
  • .*\.js.*
  • .*\.gif.*
  • .*\.png.*

For the test group, add the controllers

  • HTTP Cookie Manager and
  • HTTP Request Defaults

The later one needs to be configured to point to the NW AS Java server:

/wp-content/uploads/2013/08/recwdj2_262513.jpg

Browser settings

jMeter records what passes its proxy, so when you use Internet Explorer, jMeter will record how IE is interacting with the application. As SAP may choose to send out other files when accessing the application using Firefox or Chrome, you have to run the same recording steps again for each browser that is going to be tested. The browser needs to be configured to use the jMeter HTTP Proxy:

/wp-content/uploads/2013/08/recwdj3_262521.jpg

Record the test

After the HTTP Proxy is started, execute in the browser every step at once and name the step in jMeter. This helps a lot in identifying each step after the test is recorded.

/wp-content/uploads/2013/08/recwdj4_262522.jpg

Replay the test

This is a step where special attention is needed. Right after recording the steps they can executed using jMeter and everything will work. Replaying the script some time later, the test will fail:

/wp-content/uploads/2013/08/recwdj5_262523.jpg

Failed to process the request: Request refers to an unknown session

The reason is that WD uses several parameters to identify a session. When the browser is calling the application, additional information is also send. This information is recorded by jMeter:

/wp-content/uploads/2013/08/recwdj6_262524.jpg

Of course, this information is not valid anymore.

Hint: when you record your test and immediately afterwards replay the samples, it may work, as the session can still be open and valid. Running the test 5 days later will show errors, as the sessions expired.

How are these values set?

These values are set by the WDJ application. The first time the browser accesses the application, WD initializes a session and sets these values. The values are set inside the HTML file sent back to the browser. They are not cookies and therefore are not handles by the HTTP Cookie Manager. jMeter comes with regular expression extractors that allow to extract the value of a given regular expression and assign it to a jMeter variable. These variables in turn can be used as placeholders in the HTTP requests.

Some useful parameters to extract are

  • sap-wd-cltwndid
  • sap-wd-appwndid
  • sap-wd-secure-id
  • sap-ext-sid

sap-wd-cltwndid

name=”sap-wd-cltwndid” value=”(.+?)”

/wp-content/uploads/2013/08/recwdj7_262525.jpg

sap-wd-appwndid

name=”sap-wd-appwndid” value=”(.+?)”

/wp-content/uploads/2013/08/recwdj8_262526.jpg

sap-wd-secure-id

This parameter depends on your NW AS Java WD version.

7.1: name=”sap-wd-secure-id” value=”(.+?)”

/wp-content/uploads/2013/08/recwdj9_262527.jpg

7.3: {0:’sap-wd-secure-id’,2:'(.+?)’}

/wp-content/uploads/2013/08/recwdj10_262528.jpg

sap-ext-sid

name=”sap-ext-sid” value=”(.+?)”

/wp-content/uploads/2013/08/recwdj11_262529.jpg

Adding these regular expression extractors to the test case will assign the variables with the current valid parameter value. Now the HTTP request needs to be adjusted to make use of the variables.  In my case, I annotate the values of the parameter and substitute them through variables using notepad.

Example

/wp-content/uploads/2013/08/recwdj12_262530.jpg

The value is k6V1s3CcEmwzsSJH6ummAg==. The values needs to be replaced by ${sap-wd-secure-id}

/wp-content/uploads/2013/08/recwdj13_262531.jpg

Afterwards, the HTTP Request looks like this in jMeter:

/wp-content/uploads/2013/08/recwdj14_262532.jpg

After adjusting these parameters, running the jMeter test now gives:

/wp-content/uploads/2013/08/recwdj15_262533.jpg

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

    1. Tobias Hofmann Post author

      Hi Robin,

      glad you liked it, hope you can apply it sometime.

      Little views? Published over 2 month ago, makes hardly 3 views per work day. Yes, from effort / view ratio this content is for sure a complete failure.

      Lesson learned: don’t write about tests and avoid the name Java in the title. Maybe publishing it as a document and not as a blog didn’t help too. Should I move on and write about: 10 tips on how to pass SAP certification?

      (0) 

Leave a Reply