2017-07-10 23 views
1

使用JMeter,我試圖測試我的應用程序性能。JMeter:在響應特定的HttpRequest後,等待3秒鐘以調用下一個請求

這是我第一次挖掘JMeter。所以如果有任何技術詞缺失,請讓我知道。

所以要我的查詢,

我們的應用程序需要驗證才能訪問,除了登錄和註冊的任何請求。

enter image description here

我的測試計劃是像上面。

A) Login Request (It should be call for every user first, then only (2) will perform) 
    1) based on credential in CSV file (Working) 
    2) Post processing using BeanShell Post processor (Working) 
    3) Store token and user id in variables for Next request (Working) 
    4) The token will be sent through Every HttpRequest Header (Working) 

B) Random Controller 
    1) List of HttpRequest's 
     invoke HttpRequest randomly (Working) 
    2) For Dashboard Request, after the getting the response, sleep 3 seconds and continue the flow. (only this thread will wait) 

我現在需要的是,

1)一般情況下,當接收到響應,用戶讀取內容。對於某些反應很大,有些反應較小。因此,閱讀內容的時間取決於內容大小。

我想在JMeter中實現同樣的事情。收到儀表板響應後,等待3秒鐘(我將爲不同的需求指定不同的時間),然後調用下一個隨機的HttpRequest。

我試着用Http Request - > Constant Timer。但它在請求之前工作(反向:在調用請求之前,等待特定時間)。

那麼有沒有任何計時器幫助我的測試計劃設計?

另外,我想到了BeanShell Post處理器可能會有所幫助。但沒有發現任何東西。

回答

1

我看到2個選項在這裏:

  1. 使用的控制器,測試動作,和定時器,如所描述here。 也就是說將事務控制器設置爲儀表板請求的父級。添加測試行動具有恆定的或可變的暫停同一控制下以模擬延遲:

    Random Controller 
        Transaction Controller 
        Dashboard Request 
        Test Action 
        Other HTTP Request 
    
  2. 使用BeanShell的,或任何其它可編程後處理器和相應的語言的力量來暫停。例如用BeanShell的後處理器可以

    Thread.sleep(3000); // pauses for 3 sec. after request 
    

第二種解決方案是,似乎更短,速度更快。但語義上首先表達更好的意圖。

+0

哦..與測試行動一樣偉大。謝謝你,基里爾。 – Satish

+0

您提到的博客(http://jmeter-tips.blogspot.in)非常有幫助。感謝Victor Klepikovskiy – Satish

相關問題