SoapUI中如何识别该步骤是RunTestCase?
How to identify that the step is RunTestCase in SoapUI?
我有以下结构:
每个功能都在可重用脚本中分解,并在主套件中重用所有功能。
TestCase 1:
1. Login as Normal Customer (This is calling login test case from Reusable script)
2. Extract Session from STEP 1
3. Add diner card (This is calling add card test case from Reusable script)
4. View Added Card (This is calling view test case from Reusable script)
5. etc..
现在可重用脚本中的每个测试用例 returns 一个 属性 r_result(通过或失败)
现在我想检查每个 运行 测试用例并查看 属性 r_result 是通过还是失败。如果它失败了,我需要检查第一次失败发生的位置(在 RunTestCase
中)并报告该错误。
是否可以在每个测试用例中仅隔离 RunTestCase 步骤,并在闭包中使用它来获取每个 RunTestCase 结果的结果?
这是可以在 soapui 项目中获取匹配测试步骤列表的脚本。
请关注在线评论。
result
变量包含所需类型的所有测试步骤列表。您可以利用这些数据来做必要的事情。
脚本:
import com.eviware.soapui.impl.wsdl.teststeps.WsdlRunTestCaseTestStep
//To identify lookup test step is not this step
def currentStepMap = [ suite : context.testCase.testSuite.name, case : context.testCase.name, step : context.currentStep.name ]
//Type of step to look for
def stepTypes = [WsdlRunTestCaseTestStep]
//To hold the final result
def result = []
//Find the test step details of matching step
def getMatchingMap = { suite, kase, step ->
def tempMap = [suite : suite.name, case : kase.name, step: step.name]
def isNotMatching = currentStepMap != tempMap ? true : false
if (isNotMatching &&(stepTypes.any{step in it}) ) {
tempMap
} else { [:] }
}
def project = context.testCase.testSuite.project
//Loop thru the project and find the matching maps and list them
project.testSuiteList.each { suite ->
suite.testCaseList.each { kase ->
kase.testStepList.each { step ->
def tempResult = getMatchingMap(suite, kase, step)
if (tempResult) {
result << tempResult
}
}
}
}
if (result) {
log.info "Matching details: ${result} "
} else {
log.info "No matching steps"
}
我有以下结构:
每个功能都在可重用脚本中分解,并在主套件中重用所有功能。
TestCase 1:
1. Login as Normal Customer (This is calling login test case from Reusable script)
2. Extract Session from STEP 1
3. Add diner card (This is calling add card test case from Reusable script)
4. View Added Card (This is calling view test case from Reusable script)
5. etc..
现在可重用脚本中的每个测试用例 returns 一个 属性 r_result(通过或失败)
现在我想检查每个 运行 测试用例并查看 属性 r_result 是通过还是失败。如果它失败了,我需要检查第一次失败发生的位置(在 RunTestCase
中)并报告该错误。
是否可以在每个测试用例中仅隔离 RunTestCase 步骤,并在闭包中使用它来获取每个 RunTestCase 结果的结果?
这是可以在 soapui 项目中获取匹配测试步骤列表的脚本。
请关注在线评论。
result
变量包含所需类型的所有测试步骤列表。您可以利用这些数据来做必要的事情。
脚本:
import com.eviware.soapui.impl.wsdl.teststeps.WsdlRunTestCaseTestStep
//To identify lookup test step is not this step
def currentStepMap = [ suite : context.testCase.testSuite.name, case : context.testCase.name, step : context.currentStep.name ]
//Type of step to look for
def stepTypes = [WsdlRunTestCaseTestStep]
//To hold the final result
def result = []
//Find the test step details of matching step
def getMatchingMap = { suite, kase, step ->
def tempMap = [suite : suite.name, case : kase.name, step: step.name]
def isNotMatching = currentStepMap != tempMap ? true : false
if (isNotMatching &&(stepTypes.any{step in it}) ) {
tempMap
} else { [:] }
}
def project = context.testCase.testSuite.project
//Loop thru the project and find the matching maps and list them
project.testSuiteList.each { suite ->
suite.testCaseList.each { kase ->
kase.testStepList.each { step ->
def tempResult = getMatchingMap(suite, kase, step)
if (tempResult) {
result << tempResult
}
}
}
}
if (result) {
log.info "Matching details: ${result} "
} else {
log.info "No matching steps"
}