2017-09-06 77 views
0

我有一套測試用例ReusableComponent測試套件。我們可以在Soapui獲得每個api呼叫響應時間嗎?

我無法單獨運行ReusableComponent.It沒有會話和otherstuff。當從其他套件調用時,它會將必要的數據傳遞給可重用組件。

我們可以使用下面的閉包來獲得每個API調用響應時間嗎?

testSuite = testRunner.testCase.testSuite.project.testSuites["ReusableComponent"] 
//Loop thru each case of the suite and find those matching properties and clear them 
testSuite.testCaseList.each { testcase -> 
      testcase.testStepList.each{testStepName -> 
    log.info(testStepName.name) 
    def props = testcase.testSteps["$testStepName"].testRequest.response.timeTaken 
    def msg = props ?: 'None' 
    log.info "Reponse Time for ${testStepName} test are : ${msg}" 
} 
} 

我收到以下錯誤:

Can not get Property TestRequest on Null object. 

此錯誤消息說,因爲我沒有運行該測試情況下,它說。但不能單獨運行ReusableComponent。是否有任何人在整個運行後得到時間,只需要從ReusableComponent套件中獲取時間

回答

0

下面的語句會讓您花費時間請求調用。

log.info "Time taken : ${testRunner.timeTaken}" 

如果在測試用例TearDown Script使用,那麼它會給測試用例的執行時間。

如果測試套件TearDown Script,然後用​​

+0

例如,我已經Groovy腳本和數量增加等。我們可以得到的響應時間對於每個REST調用只能用幾個推倒腳本? – ChanGan

相關問題