Ich versuche, die Zeit zwischen zwei Ereignissen in JMeter mit BeanShell PostProcessors zu berechnen.JMeter BeanShell-Eigenschaft Einstellung über Thread-Gruppe
Im ersten Block, bekomme ich die Zeit und speichern Sie es als eine Eigenschaft. Dies ist in einer Thread-Gruppe. Dann habe ich in einer anderen Thread-Gruppe den zweiten BeanShell-Block. Ich bekomme einen Fehler, den ich nicht verstehen kann. Ich habe den Fehler hier eingefügt. Vielen Dank für Ihre Tipps und Hinweise!
Hier sind die beiden Stücke von Beanshell Code:
FIRST Nachprozessor:
//Set the current time to the time_upload variable
long time_upload = prev.getTime(); // get POST Time
props.put("time_upload",(String.valueof(time_upload)));
log.info("Time for Upload is: " + time_upload); // print difference to jmeter.log file
SECOND Nachprozessor:
String no_saved_carts = vars.get("no_saved_carts");
String no_saved_carts_trimmed = no_saved_carts.trim();
String temp_description = vars.get("description");
String temp_description_no_space = temp_description.trim();
String time_upload_local = props.get("time_upload");
if(temp_description_no_space.equals("</") || no_saved_carts_trimmed.equals("No Saved Carts Found")){
vars.put("description","true");
} else{
vars.put("description","false");
//set the time to time_processing based on time_upload
long time_processing_done = prev.getTime(); // get time
long time_upload_long = Long.parseLong(time_upload_local); // get HTTP Sampler 1 execution time from variable
long delta = (time_processing_done - time_upload); // calculate difference
log.info("Time difference is: " + delta + " ms"); // print difference to jmeter.log file
}
Der relevante Teil des ERROR LOG:
2016/06/03 17:21:22 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``//Set the current time to the time_upload variable long time_upload = prev.getTi . . . '' : Error in method invocation: Static method valueof(long) not found in class'java.lang.String'
2016/06/03 17:21:22 WARN - jmeter.extractor.BeanShellPostProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``//Set the current time to the time_upload variable long time_upload = prev.getTi . . . '' : Error in method invocation: Static method valueof(long) not found in class'java.lang.String'
2016/06/03 17:21:22 INFO - jmeter.threads.JMeterThread: Thread is done: Upload Saved Cart Thread Group 1-1
2016/06/03 17:21:22 INFO - jmeter.threads.JMeterThread: Thread finished: Upload Saved Cart Thread Group 1-1
2016/06/03 17:21:22 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``String temp_description = vars.get("description"); String no_saved_carts = vars. . . . '' : Typed variable declaration : Method Invocation Long.parseLong
2016/06/03 17:21:22 WARN - jmeter.extractor.BeanShellPostProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``String temp_description = vars.get("description"); String no_saved_carts = vars. . . . '' : Typed variable declaration : Method Invocation Long.parseLong
2016/06/03 17:21:26 INFO - jmeter.threads.JMeterThread: Thread is done: Check Upload Status 2-1
ausgezeichnete Antwort! Danke, dass du mir geholfen hast und mir mehr über JMeter beigebracht hast :) – ProgrammedChem