从 SoapUI 中的测试套件的所有测试用例中删除 属性 值?
Removing the property values from all test cases of a test suite in SoapUI?
我在一个测试套件中有 108 个测试用例。
在每个测试用例中,它具有某些以 r_
开头的属性(意味着它是来自其他测试用例的 return 变量)。我想删除所有以 r_
.
开头的 属性 值
我可以在每个测试用例中通过 TearDown Script
来做到这一点。但是,这需要很多时间。
是否可以从套件级别 TearDown Script
执行相同的操作?
是的,有可能。
下面是套房级别TearDown Script
。
//Define the pattern of property names which you want to clear the values
def pattern = 'r_'
//Loop thru each case of the suite and find those matching properties and clear them
testSuite.testCaseList.each { kase ->
def props = kase.propertyNames.findAll { it.startsWith(pattern) }
def msg = props ?: 'None'
log.info "Matching properties for ${kase.name} test are : ${msg}"
props?.each { prop -> kase.setPropertyValue(prop, '')}
}
我在一个测试套件中有 108 个测试用例。
在每个测试用例中,它具有某些以 r_
开头的属性(意味着它是来自其他测试用例的 return 变量)。我想删除所有以 r_
.
我可以在每个测试用例中通过 TearDown Script
来做到这一点。但是,这需要很多时间。
是否可以从套件级别 TearDown Script
执行相同的操作?
是的,有可能。
下面是套房级别TearDown Script
。
//Define the pattern of property names which you want to clear the values
def pattern = 'r_'
//Loop thru each case of the suite and find those matching properties and clear them
testSuite.testCaseList.each { kase ->
def props = kase.propertyNames.findAll { it.startsWith(pattern) }
def msg = props ?: 'None'
log.info "Matching properties for ${kase.name} test are : ${msg}"
props?.each { prop -> kase.setPropertyValue(prop, '')}
}