由於我想自定義標題發送現場時間以獲得正確的響應,我試圖使用BSH Pre-processor
設置標題,我看到正在創建的標題屬性和來自腳本的應用邏輯值也在工作,但是當我運行它時,它不會返回值。Beanshellpreprocessor JMeter問題,同時使用設置標題信息
在控制檯我也看到了問題控制檯
2016/08/23 07:10:05 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import org.apache.jmeter.protocol.http.control.Header; long fromtime = 14719164 . . . '' Token Parsing Error: Lexical error at line 14, column 3. Encountered: "a" (97), after : "\'s"
2016/08/23 07:10:05 WARN - jmeter.modifiers.BeanShellPreProcessor: Problem in BeanShell script org.apache.jorphan.util.JMeterException: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import org.apache.jmeter.protocol.http.control.Header; long fromtime = 14719164 . . . '' Token Parsing Error: Lexical error at line 14, column 3. Encountered: "a" (97), after : "\'s"
2016/08/23 07:10:06 INFO - jmeter.util.BeanShellTestElement: To Time is ******1471916406355
2016/08/23 07:10:06 INFO - jmeter.util.BeanShellTestElement: fromtime value is ******1471916406355
我比較了工作的人的要求和它看起來完全平等的,但不工作。
請建議如果我做錯了什麼。
的BSHPreprocessor
可以如下發現:
import org.apache.jmeter.protocol.http.control.Header;
long fromtime = ${__javaScript(Math.round(new Date().getTime()))}l;
long ttt = 3599000l;
long totime = fromtime + ttt;
String strLong = Long.toString(fromtime);
log.info("To Time is ******" + strLong);
log.info("fromtime value is ******" + fromtime);
sampler.getHeaderManager().add(new Header("to-time"," " +totime));
sampler.getHeaderManager().add(new Header("from-time"," " +strLong));
請幫助我儘早