cancel
Showing results for 
Search instead for 
Did you mean: 

String with two variables failing

Highlighted
New Contributor

String with two variables failing

I have two questions

1.

String asdf = ['B','S']
String qwer = ['B']
def result = getExpectedResult(asdf, qwer)
log.info result

 

Its failing

am expecting it takes something like getExpectedResult(['B','S'], ['B']). How to achieve

 

2.

am getting outputs from database like 

[A,B]

[A]

[B,S,L,N]

[E]

[P]

and so on ...

All these results are generated in a loop.

How to achieve as

['A',B']

['A']

['B','S','L','N']

['E']

['P']

 

 

2 REPLIES 2
Highlighted
Community Hero

Re: String with two variables failing

Hi,

 

Your question isn't really a SoapUI one, and may be more suitable for a site like stackexchange.com that has a Groovy specific section.

 

(I don't mind answering some Groovy questions here, but can only do so when they are well formulated.)

Highlighted
New Contributor

Re: String with two variables failing

def asdf = ["B","S"]
def qwer = ["B"]
log.info asdf
String result = getExpectedResult(asdf,qwer)
log.info result

 

public String getExpectedResult(def dbList, def inputCom)
{
def masterSet = [A:'A',B:'BS',C:'CDE']
def status= "true"
for(e in inputCom){
masterValOfCom = masterSet[e]
log.info masterValOfCom
dbList.each{
if(!masterValOfCom.contains(it)){
status="false"
return status
}
}
}
return status
}

 

The above returns true which is good.

 

Now I have list of values coming from the loop as for asdf as 

[A,B]

[A]

[B]

and so on.. 

and values for qwer are [A],[B],[C]

now hyow to insert these asdf and qwer in getExpectedResult

because now I use the above code its throwing me error stating MissingPropertyException

New Here?
Join us and watch the welcome video:
Top Kudoed Authors