add into java option of the project before launch
-Djbo.debugoutput=console
Return back to talk about ADF and JMETER
I've added PreProcessor scripts to set request variables and URL parameters of the requests.
Using that template you should only record the test case, and than PreProcessor scripts provides to add variables at every sample of the test at runtime.
into the template there are also a CSV predisposition with 2 variables username and login
PreProcessor script to update request arguments:
import java.util.regex.*;
args = sampler.getArguments();
argCount = args.getArgumentCount();
for(int i=0; i<args.getArgumentCount();i++){
arg = args.getArgument(i);
if(arg.getName().equals("_afrLoop")){
arg.setValue(vars.get("afrLoop"));
}
else if(arg.getName().equals("jsessionid")){
arg.setValue(vars.get("jsessionid"));
}
else if(arg.getName().equals("_adf.ctrl-state")){
arg.setValue(vars.get("adf.ctrl-state"));
}
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("Adf-Window-Id")){
arg.setValue(vars.get("afrWindowId"));
}
else if(arg.getName().equals("_afrRedirect")){
arg.setValue(vars.get("afrRedirect"));
}
else if(arg.getName().equals("_afrWindowMode")){
arg.setValue(vars.get("afrWindowMode"));
}
else if(arg.getName().equals("_afrPage")){
arg.setValue(vars.get("afrPage"));
}
}
PreProcessor script to update path variable Adf-Window-Id
import java.util.regex.*;
// La regex per cercare e sostituire il valore di param1
String regex = "Adf-Window-Id=(w[0-9]{2})";
String replacement = "Adf-Window-Id=${afrWindowId}";
String path = ctx.getCurrentSampler().getPath();
//System.out.println("0. "+path);
// Prendi il campione della richiesta HTTP corrente
if (path != null) {
// Prendi la richiesta HTTP corrente
String request = path;
//System.out.println("2. "+request);
// Effettua la sostituzione del valore di Adf-Window-Id
String modifiedRequest = request.replaceAll(regex, replacement);
//System.out.println("3. "+modifiedRequest);
// Aggiorna il corpo della richiesta con la nuova URL
ctx.getCurrentSampler().setPath(modifiedRequest);
// System.out.println("4. "+sampler.getPath());
// System.out.println("5. "+ctx.getCurrentSampler().getPath());
}