肥皂用户界面中的测试用例。
1. Datasource feeded for all operators
2. Login call
3. Search List call
4. Verify the search list for each operator
//Defining the SearchList for UserRole
String[] operator1= ["xx","yy","zz","aa"]
String[] operator2= ["bb","cc","dd"]
String[] operator3 = ["bb","cc","aa"]
To Verify the response based on operator I am using below code.
//Extract Reponse and count of nodes
/*
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
respXml=groovyUtils.getXmlHolder("SearchList#ResponseAsXml")
count=Integer.parseInt(respXml["count(//Response[1]/e)"]) */
//Extract Role from
def role = context.expand( '${DataSource#Role}' )
log.info(role)
for(i=1; i<=count;i++){
element1=role[i-1]
log.info(element1)
}
我希望在角色为operator1时打印“xx”,“yy”,“zz”,“aa”,但不幸的是它会以不同的长度打印opeartor1。如何动态传递使用角色。
答案 0 :(得分:1)
例如,您可以使运算符成为
之类的映射def operators = [
operator1: ["xx","yy","zz","aa"],
operator2: ["bb","cc","dd"],
operator3: ["bb","cc","aa"]
]
然后使用operators."$role"
或operators[role]
检索相应的列表。 (如果role
不是字符串,则在后一种情况下您可能需要operators["$role"]
或operators[role as String]
。