In this post, I will explain how to configure a JMeter script to perform an Oracle ADF Load Test. As you know, most of the popular dynamic web frameworks should be configured for correlating processes on JMeter. Correlation is simply the process of capturing and storing the dynamic response from the server and passing it on to subsequent requests. Unlike other frameworks, you should spend extra effort configuring correlation dynamic variables when working with Oracle ADF and JMeter.
Record your ADF Login Processes
First, record your ADF application’s login processes using JMeter’s “HTTP Test Script Recorder”. You can exclude the types of content you do not want to request (e.g. *.jpg, *.png, *.js, etc.) by selecting “Add Suggested Excludes” option on JMeter Test Script Recorder.
After the recording is completed, our script is simply this:
I have renamed it to something meaningful and moved it from Recording Controller to Thread Group section.
Correlations
When I run this script without configuring correlation, the response is a “500” error code as seen below.
To overcome this situation we need to handle correlations. As I said above when working on ADF, you have to pay extra attention to dynamic parameters. In the screenshot below are the parameters, pointed to by red arrows, which we need to extract from the response and pass to the next request.
Besides these parameters, I would also like to add some dynamic variables for further steps like a “return” parameter.
return: _rtrnId=([-_0-9A-Za-z!]{10,13})
unique: _afrLoop\”,\ “([-_0-9A-Za-z]{13,16})
adf.ctrl-state: _adf.ctrl-state=(.+?)”
adf.ctrl-state(Alternative Reg.Exp): _adf.ctrl-state=([-_0-9A-Za-z!]{10,13})
javax.faces.ViewState: <input type=”hidden” name=”javax\.faces\.ViewState” value=”!(.+?)”>
afrWindowId : window.name='([-_0-9A-Za-z!]{10,13})’
afrWindowMode : _afrWindowMode=(\d+)
afrLoop : _afrLoop=([-_0-9A-Za-z]{13,16}).
After completing Regular Expression Extractors, add an HTTP Cookie Manager sampler for our script’s structure like this.
Configuring Requests
Now it’s time to configure our requests using extracted parameters’ recent values from the response. I will use Beanshell PreProcessor and later we won’t have to handle each request parameter section. See code at end of the post.
Previously we declared the extractors to be configure to extract the dynamic values as shown above screenshot. Now pass ${javax.faces.ViewState} variable to each request sampler by overriding the already present hard coded value of “javax.faces.ViewState” variable as shown below:
However because we are using Beanshell Preprocessor we don’t have to make these changes on every request. It makes the changes automatically for us. The Beanshell PreProcessor overrides the parameter before the next request is sent. We just need to manual set parameter when filling Path section as a {adf.ctrl-state}.
We are almost ready to run our Oracle ADF Load Test. We just run our test script again and as you see after completing configuration we successfully got this response:
Running your Oracle ADF Load Test
After checking that your script worked well, you are ready to run this script, as you would with any JMeter script, on AWS (Amazon Web Services). We will do the load test using Redline13. Apache JMeter is one of the most popular tools for load testing and scaling out your JMeter test plan on the cloud in RedLine13 is easy. This guide and video walks you through running your first JMeter test on Redline13 to do an Oracle ADF Load Test.
That’s it.
Reference – Java Code for Beanshell PreProcessor
import java.util.regex.*;
args = sampler.getArguments();
argCount = args.getArgumentCount();
for(i = 0; i < argCount; i++){
arg = args.getArgument(i);
if(arg.getName().equals(“_afrLoop”)){
arg.setValue(vars.get(“afrLoop”));
}
else if(arg.getName().equals(“Adf-Window-Id”)){
arg.setValue(vars.get(“adfWindowId”));
}
else if(arg.getName().equals(“_afrWindowMode”)){
arg.setValue(vars.get(“afrWindowMode”));
}
else if(arg.getName().equals(“_rtrnId”)){
arg.setValue(“” +vars.get(“return”));
}
else if(arg.getName().equals(“javax.faces.ViewState”)){
arg.setValue(“!” +vars.get(“javax.faces.ViewState”));
}
else if(arg.getName().equals(“unique”)){
arg.setValue(vars.get(“unique”));
}
else if(arg.getName().equals(“_afrWindowId”)){
arg.setValue(vars.get(“afrWindowId”));
}
else if(arg.getName().equals(“_adf.ctrl-state”)){
arg.setValue(vars.get(“adf.ctrl-state”));
}
log.info(arg.getName() + ” : ” + arg.getValue());
}
By Guest Blogger Mustafa Mahir Kaplancı of Etiya