This is the code I'm trying to execute in the beanshell sampler :
import java.lang.*;
import java.util.*;
String name_lead = vars.get("Name_lead");
String[] lead = name_lead.split("\\s+");
for(int i=1; i<=Integer.parseInt(vars.get("title_pass_matchNr")); i++)
{
String title = vars.get("title_pass_"+i);
String fname = vars.get("firstname_"+i);
String lname = vars.get("lastname_"+i);
String[] fn = fname.split("");
if(lead[i-1].equals(title) && lead[i].equals(fn[1]) && lead[i+1].equals(lname))
{
vars.put("namep",lead[i]);
}
}
But I get the following error:
Answer message: org.apache.jorphan.util.JMeterException: error while calling bsh method: eval Source file: built-in rating: `` import java.lang; import java.util .; String name_lead = vars.get ("Name_lead"); ,, ''
I can’t figure it out. Can someone help me? How to fix it?
name_lead has something like Mr p singh .. and accepts with a regular expression extractor
source
share