We need to add n Minutes to a work order start time variable (WOStartTime) for every sample, what are possible ways?
Currently we are using jexl function in jp@gc - Parameterized Controller;
${__jexl(${__threadNum()}*8 + ${WOStartTime})}
where WOStartTime is a datetime fetched from a CSV file;
and getting following exception; 2014/05/20 15:44:11 ERROR - jmeter.functions.JexlFunction: An error occurred while evaluating the expression "1*8 + 5/20/2004 15:05" org.apache.commons.jexl.parser.ParseException: Encountered "15" at line 1, column 17. Was expecting one of: "||" ... "or" ... "&&" ... "and" ... "|" ... "^" ... "&" ... "==" ... "eq" ... "!=" ... "ne" ... "<" ... "lt" ... ">" ... "gt" ... "<=" ... "le" ... ">=" ... "ge" ... "+" ... "-" ... "*" ... "/" ... "div" ... "%" ... "mod" ... ";" ... at org.apache.commons.jexl.parser.Parser.generateParseException(Parser.java:4176)
We have added a BeanShell Preprocessor to manipulate datetime variable;
woStartDate=vars.get("WOStartTime");
StartTime=vars.get("Start");
EndTime=vars.get("End");
Date NewStartTime ;
if (StartTime == null){
StartTime =woStartDate;
print("StartTime == null");
}
else {
NewStartTime=StartTime;
NewStartTime.setTime(NewStartTime.getTime()+2);
StartTime=NewStartTime;
}
print(StartTime);
vars.put("Start", StartTime);
EndTime=StartTime;
EndTime.setTime(NewStartTime.getTime()+5);
vars.put("End", EndTime);
StartTime is always NULL , but after vars.put("Start", StartTime) for second sample this should not be NULL, need help to resolve the issue;