How to set and get TestStep properties in SoapUI using Java -
i trying set properties of soapui teststep inside soapui project in java shown in below screenshot.
when debug below code, getting null when getproperty
or setpropertyvalue
. point want set property variable java function couldn't able it. getting in groovy when google problem. can 1 me how in java
public class soapuitest { public final static void main(string [] args) throws exception { wsdlproject project = new wsdlproject("c:\\users\\vikram\\webservice\\webservicetest\\src\\main\\java\\weather.xml"); wsdltestsuite wsdltestsuite = project.gettestsuitebyname("weatherzip"); wsdltestcase wsdltestcase = wsdltestsuite.gettestcasebyname("weatherbyzip"); wsdlteststep wsdlteststep = wsdltestcase.getteststepbyname("getcityforecastbyzip"); wsdlteststep.setpropertyvalue("city","21001");// problem: unable set property value wsdltestcaserunner wsdltestcaserunner = new wsdltestcaserunner(wsdltestcase, new stringtoobjectmap(wsdltestcase.getproperties())); teststepresult teststepresult = wsdltestcaserunner.runteststep(wsdlteststep); if (teststepresult instanceof wsdltestrequeststepresult) { system.out.println(((wsdltestrequeststepresult) teststepresult).getresponse().getcontentasstring()); } } }
i want set value of city on fly while executing program. please me in solving this.
alright.. have figured out myself adding custom properties in testcase level instead of teststep.
wsdltestcase.setpropertyvalue("city","12345");
now soapui request body partlooks this
<soapenv:body> <weat:getcityforecastbyzip> <!--optional:--> <weat:zip>${#testcase#city}</weat:zip> </weat:getcityforecastbyzip> </soapenv:body>
Comments
Post a Comment