SoapUI 如何获取每个 TestStep 的请求和响应大小
SoapUI How to get Request and Response size for each TestStep
我有一些 Groovy 脚本可以循环当前测试用例中的测试步骤并计算每个步骤的响应时间并将其存储在测试用例的自定义 属性 中.
我现在正尝试对每个测试步骤的请求和响应大小执行相同的操作,但似乎无法正常工作。
def TestCase = testRunner.getTestCase()
def CurrentTestStep = context.testCase.getTestStepAt(context.getCurrentStepIndex()).getLabel()
def StepList = TestCase.getTestStepList().name - CurrentTestStep
def ResponseTime = 0
def RequestSize = 0
def ResponseSize = 0
StepList.each
{ Step ->
try
{
ResponseTime = ResponseTime + testRunner.testCase.testSteps[Step].testRequest.response.timeTaken
}
catch(Exception expObj)
{
}
}
testRunner.testCase.setPropertyValue("Test_Case_Response_Time", ResponseTime.toString())
您可以在下面声明响应大小。
log.info "Size of " + Step + "is " + testRunner.testCase.testSteps[Step].testRequest.response.responseSize
完整代码为
def TestCase = testRunner.getTestCase()
def CurrentTestStep =
context.testCase.getTestStepAt(context.getCurrentStepIndex()).getLabel()
def StepList = TestCase.getTestStepList().name - CurrentTestStep
def ResponseTime = 0
def RequestSize = 0
def ResponseSize = 0
StepList.each
{
Step ->
try
{
log.info "Size of " + Step + "is " + testRunner.testCase.testSteps[Step].testRequest.response.responseSize
ResponseSize= ResponseSize + testRunner.testCase.testSteps[Step].testRequest.response.responseSize
}
catch(Exception e)
{
}
}
testRunner.testCase.setPropertyValue("Test_Case_Response_Size", ResponseSize.toString())
对于请求大小,我找不到获取大小的语句。一旦得到它就会添加。
我有一些 Groovy 脚本可以循环当前测试用例中的测试步骤并计算每个步骤的响应时间并将其存储在测试用例的自定义 属性 中.
我现在正尝试对每个测试步骤的请求和响应大小执行相同的操作,但似乎无法正常工作。
def TestCase = testRunner.getTestCase()
def CurrentTestStep = context.testCase.getTestStepAt(context.getCurrentStepIndex()).getLabel()
def StepList = TestCase.getTestStepList().name - CurrentTestStep
def ResponseTime = 0
def RequestSize = 0
def ResponseSize = 0
StepList.each
{ Step ->
try
{
ResponseTime = ResponseTime + testRunner.testCase.testSteps[Step].testRequest.response.timeTaken
}
catch(Exception expObj)
{
}
}
testRunner.testCase.setPropertyValue("Test_Case_Response_Time", ResponseTime.toString())
您可以在下面声明响应大小。
log.info "Size of " + Step + "is " + testRunner.testCase.testSteps[Step].testRequest.response.responseSize
完整代码为
def TestCase = testRunner.getTestCase()
def CurrentTestStep =
context.testCase.getTestStepAt(context.getCurrentStepIndex()).getLabel()
def StepList = TestCase.getTestStepList().name - CurrentTestStep
def ResponseTime = 0
def RequestSize = 0
def ResponseSize = 0
StepList.each
{
Step ->
try
{
log.info "Size of " + Step + "is " + testRunner.testCase.testSteps[Step].testRequest.response.responseSize
ResponseSize= ResponseSize + testRunner.testCase.testSteps[Step].testRequest.response.responseSize
}
catch(Exception e)
{
}
}
testRunner.testCase.setPropertyValue("Test_Case_Response_Size", ResponseSize.toString())
对于请求大小,我找不到获取大小的语句。一旦得到它就会添加。