0
votes

The following code is in a BeanShell PostProcessor works fine when I run a test using Jmeter on GUI mode. If I run it from the command line I get the following exception:

015/09/10 18:25:13 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval    Sourced file: inline evaluation of: ``notFound="NOT_FOUND"; vars.put("AUDIT_CODE",notFound . . . '' : Typed variable declaration 
2015/09/10 18:25:13 WARN  - jmeter.extractor.BeanShellPostProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval   Sourced file: inline evaluation of: ``notFound="NOT_FOUND"; vars.put("AUDIT_CODE",notFound . . . '' : Typed variable declaration

Any idea why this could happen?

String notFound="NOT_FOUND";
vars.put("AUDIT_CODE",notFound);
String auditCode=vars.get("AUDIT_CODE");
if(auditCode.equals("NOT_FOUND")){
    if (vars.get("AUDITS_RESULT_0")!=null){
        String audit = vars.get("AUDITS_RESULT_0");
        if(audit.contains("WAITING")){
            String[] auditLineWithCode = audit.split("auditCode=");
            String[] auditLineJustWithCode=auditLineWithCode[1].split(",");
            vars.put("AUDIT_CODE",auditLineJustWithCode[0]);
            log.info("AUDIT_CODE:"+vars.get("AUDIT_CODE"));
        }   
    }
}
1

1 Answers

0
votes

Change this line:

audit = vars.get("AUDITS_RESULT_0");

to

String audit = vars.get("AUDITS_RESULT_0");