我们可以在 Soapui 中获取每个 api 调用响应时间吗?

Can we get the each api call response time in Soapui?

我有一套测试用例 ReusableComponent 测试套件。

我不能 运行 ReusableComponent alone.It 没有会话和其他东西。当从其他套件调用时,它会将必要的数据传递给可重用组件。

我们可以使用下面的闭包获取每个 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套件中获取时间

下面的语句将为您提供请求调用所花费的时间。

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

如果用在TearDown Script的测试用例中,那么它会给出测试用例的执行时间。

如果测试套件 TearDown Script,则使用 log.info runner.timeTaken