我在一个测试套件中有 108 个测试用例。
在每个测试用例中,它都有某些属性开头r_
(意味着它是其他测试用例的返回变量)。我想删除所有以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, '')}
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句