简体   繁体   中英

Need unique property to use for different Test Cases in SoapUI free

I am trying to reuse soap testcases into loadUi , but I am using the free version, so data driven testing, with excel or db is out of the question. Now my problem is I need unique ID for each virtual user, but this id has to be reused in the 2nd testcase the Test Suite.

I figured that:

TC1, ID

RPO_153480953${=javax.xml.datatype.DatatypeFactory.newInstance().newXMLGregorianCalendar(GregorianCalendar.getInstance())} - unique

TC2, ID: Same as above, of course will not match because is a second later and the date isn't the same.

I did use "Property transfer" but that doesn't help since my function createa another unique id, and TC2 would have to reuse the property for TC1.

Can you please help me?

I think you could easily achieve this by using groovy script Test step in SOAP UI and I hope it available in SOAP UI free version also.

Using the below code in TC1

groovyUtils = new com.eviware.soapui.support.GroovyUtils( context );   
 ResHolder = groovyUtils.getXmlHolder("Request 1#Response" );  
  //Xpath_UniquID = proper xml path of generated Unique ID  
  UniqID = ResHolder.getNodeValue( Xpath_UniquID );   
  //Set UniqID to TestSuite properties
testRunner.testCase.testSuite.setPropertyValue( "UniqueID", UniqID  )

Here the value of "UniqID" set to Test Suite property "UniqueID" and you may fetch this value from any of the Testcase / Teststep in SOAP-UI TestSuite by using ${#TestSuite#UniqueID} in request xml of another Test case [TC2].

Hope it helps to solve your issue.

Thanks, Madhan

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM