2016-11-01 81 views

回答

1

這是可能的一些腳本。

  1. 添加Beanshell PreProcessor到您的測試計劃(在同一水平作爲你的HTTP請求)
  2. 將下面的代碼放入預處理器的「腳本」區域:

    sampler.addArgument("token", "token_value"); 
    

    更換tokentoken_value與您的實際數據

當您運行測試Beanshell Pre處理器將在每個採樣器之前執行並將參數添加到範圍中的每個HTTP Request

參考文獻:

+0

的POST請求的屏幕截圖樣例謝謝Dimitri,工作就像一個魅力。 if(sampler.getMethod()。equalsIgnoreCase(「post」)){sampler.addArgument(「token」,vars.get(「VALUE」)); }'限制執行到POST方法。 – ranj

相關問題