Jmeter 后置處理器 BeanShell_PostProcessor 適用思考


首先摘抄一段官方文檔的話:

The following BeanShell variables are set up for use by the script:

  • log - (Logger) - can be used to write to the log file
  • ctx - (JMeterContext) - gives access to the context
  • vars - (JMeterVariables) - gives read/write access to variables:
    vars.get(key);
    vars.put(key,val);
    vars.putObject("OBJ1",new Object());
  • props - (JMeterProperties - class java.util.Properties) - e.g. props.get("START.HMS"); props.put("PROP1","1234");
  • prev - (SampleResult) - gives access to the previous SampleResult
  • data - (byte [])- gives access to the current sample data

For details of all the methods available on each of the above variables, please check the Javadoc




根據官方文檔可以看到, jmeter的beanshell前置處理器有一些內置的變量

log 對應的對象是Logger


ctx 對應的對象是JMeterContext  

vars對應的對象是 JMeterVariables

props對應的對象是class java.util.Properties

prev對應的對象是SampleResult,但是需要注意他是獲取前一次請求的SampleResult

data對應的對象是是一個字節數組

有了幾個內置的參數,基本上可以可以對jmeter進行完整的控制, 另外每個對象具體有哪些屬性和方法, 可以參考jmeter對應的接口文檔



參考官方文檔  http://jmeter.apache.org/usermanual/component_reference.html#BeanShell_PostProcessor



免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM