Groovy

Groovy (beta) code posted
created at 29 Sep 14:47

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package soapui.em3.releb;

import com.eviware.soapui.support.*;
import com.eviware.soapui.model.testsuite.*;
import com.eviware.soapui.support.XmlHolder;
import com.eviware.soapui.impl.wsdl.teststeps.*;
import com.eviware.soapui.support.GroovyUtils;
import com.eviware.soapui.model.testsuite.TestRunContext;


public class getOperation {

def MATCHES="False";

def compareFunction(String testResponseName, String xpathQuery ) {

def functionholder = getXmlHolder(testResponseName);
functionholder.namespaces["se"] = "http://fabric.bbc.co.uk/em3/1.0/LIB_MediaAssetService/wsdl/IMediaAssetService"

for ( value in functionholder.getNodeValues(xpathQuery)) 
{
    //log.info "from response:"+value
    for(prp in testRunner.testCase.getPropertyNames())
    {
        if(value == testRunner.testCase.getPropertyValue(prp)){
            log.info "Property matches " + value +"=="+testRunner.testCase.getPropertyValue(prp);
    //    log.info "Testproperty:" + testRunner.testCase.getPropertyValue(prp)
        MATCHES = "True";
        break;        
        }
    }
}
assert MATCHES == "True"
}
}


1.11 KB in 3 ms with coderay