-
Notifications
You must be signed in to change notification settings - Fork 37
User guide
steeltomato edited this page Sep 26, 2011
·
11 revisions
The following provides a tutorial for a typical use case. We will use the proxy to record some AMF traffic then set up some replacement values and play back the test. Your results may vary. Each application may have a unique set of variables that the server uses to identify clients and sessions. In our case, we will use a variable called 'subSession' that is part of each request.
Note: Most elements are added to JMeter by right clicking on an element then going to Add and selecting the element. I will abbreviate that process in this tutorial for the sake of brevity. For example, to add a Thread Group to the Test Plan, I will write: Test Plan -> Threads -> Thread Group.
- Test Plan -> Threads -> Thread Group
- Thread Group -> Config Elements -> HTTP Cookie Manager
- Thread Group -> Config Elements -> AMF Request Defaults
- Thread Group -> Logic -> Recording Controller
- Thread Group -> Listeners -> View Results Tree
- Thread Group -> Listeners -> View Results Summary
- Workbench -> Non-Test Elements -> AMF Proxy Server
- Set the port, content-type filter and URL patterns as desired
- Check "Include Think Time" if you want the samples to be played back at the same rate they were recorded
- Start the proxy
- If using Firefox, use FoxyProxy plugin to connect to localhost with the port from the proxy server
- Use your application as desired, the recorded samples will appear in the Recording Controller
- Look through the samples for values that need to be unique for each virtual user.
Here is an abbreviated example:
<ActionMessage>
<version>3</version>
<headers/>
<bodies>
<MessageBody>
<data class="object-array">
<RemotingMessage>
<destination>blazeEndpoint</destination>
<messageId>MSG-123</messageId>
<clientId>CL-123</clientId>
<headers>
<entry>
<string>DSId</string>
<string>DS-123</string>
</entry>
</headers>
<operation>perform</operation>
<parameters>
<org.test.SampleRequestVO>
<subSessionId>60623D0F580A</subSessionId>
<methodName>login</methodName>
<methodArg>${username}</methodArg>
</org.test.SampleRequestVO>
</parameters>
</RemotingMessage>
</data>
</MessageBody>
</bodies>
</ActionMessage>
- In my case, there are three variables that need to be unique: DSid, clientId and subSession
- ${username} is a user variable
- Add Thread Group -> Config -> Counter, we will use this to make an incrementing value for each thread
- Set the reference name to userId, start to 100 and increment to 1
- In the AMF Request Defaults, under Value Replacement, set up the replacements:
- My current clientId is
CL-123
so I enter that into the 'name' column andCL-${userId}
into the value column - Repeat for each variable
- My current clientId is
- Run -> Start
- View Results Tree will show the output of each sample. The AMF is not decoded (yet) but you can generally tell if the samples were successful
- For my testing, I typically use Charles and run the samples through it by setting Proxy Server in AMF Request Defaults
- When you are ready to do a real load test, change the Thread Group settings to add more users.
- The request is in sampler "Auth" above will send a username to establish a session. Let's make sure we didn't mess up the variable replacement by checking the response for the infamous "duplicate flex session" error.
- In Auth, change Response Variable to auth_res
- Auth -> Add -> Assertion -> Response Assertion (Should be a child of Auth)
- Select JMeter Variable under Apply to: and enter auth_res
- Select Contains, check Not and Add a new test pattern, enter Detected duplicate
- By changing the Thread Group error action to Stop Test the entire suite will halt if the server returns this error
- As above, we will store the sampler's XML response in auth_res
- As a child of Auth, Add Post Processor -> Regular Expression Extractor
- Apply to: Select JMeter Variable and enter auth_res
- Reference Name:
SESSIONID
- Regular Expression:
<sessionId>([A-za-z0-9]*)</sessionId>
- Template:
$1$
- Match No:
1
- Default Value:
Missing
- To use in another sample, insert
${SESSIONID}
inside the sessionId tag of the request