I have this in a BeanShell Preporcessor:

// set up some vars for substitution on queries
int studentId = 100000+Integer.parseInt("${__threadNum}"); // offset students enough

java.util.Random r = new java.util.Random();
int classId = r.nextInt(250000)+100000;

// substitute vars in queries
vars.put("query", vars.get("query").replace("~studentId~", ""+studentId));
vars.put("query", vars.get("query").replace("~classId~", ""+classId));
vars.put("query", vars.get("query").replace("~groupId~", ""+classId));

I have this in the condition of an If Controller:

${__BeanShell(!"<EOF>".equals("${query}"))}

this in another if:

${__BeanShell("${query}".trim().startsWith("-- end of page "))}

This as the query type of a JDBC Request:

${__BeanShell("${query}".trim().toUpperCase().startsWith("SELECT") ? "Select Statement" : "Update Statement")}

Hope this helps...


On Jun 15, 2007, at 8:12 AM, aidy lewis wrote:

Hi,

Has anybody got any examples of using beanshell scripting within JMeter please?

Aidy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to