64834

soapUI - embbed XML in a request using groovy

Question:

I'm making test cases on soapUI, on some steps I would use a REST quest and put XML code in the lower pane, something like

<dataList> <data> 3.1416 </data> <data> 5.11 </data> </dataList>

But I need to get the response and store the results that will be contained inside the XML text of the response, to verify that the web service is executing proper operations and then send more requests using the received results.

Thanks everyone!

Answer1:

I could solve this using properties and Property Transfer

<ol><li>

Add a property to the TestCase in the Custom Properties tab

</li> <li>

Add a property Transfer step

2.1 As source select the test step with the response where are the results to store

2.2 In the drop down list of property select ResponseAsXml

2.3 In text are of the source write the path of the xml tag like: /dataList/data

2.4 As target select the test case where was added the custom property of (1)

2.5 As target property select the name of the custom property added.

</li> </ol>

Thank you very much to everyone for your prompt answers :) As soon as I have better reputation I'll post some pictures.

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/1wqkl.png" data-original="https://i.stack.imgur.com/1wqkl.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/Nghnw.png" data-original="https://i.stack.imgur.com/Nghnw.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

Answer2:

A Groovy script test step which goes with your test suite as below:

def grUtils = new com.eviware.soapui.support.GroovyUtils(context) def holder = grUtils.getXmlHolder( context.expand('${TestStep#Response#//node}')) println holder.getXml() //where TestStep = Your test Step where you get the response //node = The xml node you want to pick. In your case it is "dataList"

Recommend

  • Generating random numbers directly inside a .htaccess file
  • In Akka, is ActorContext thread safe?
  • How to use the resource module to measure the running time of a function?
  • Regex for nested values
  • File extension of zlib zipped html page?
  • Python cosine function precision [duplicate]
  • Aptana 3 remove bundle (jquery)
  • vectorized indexing/slicing in numpy/scipy?
  • Rest Services conventions
  • Pass Dictionary to Javascript array
  • Button text different than value submitted in query string
  • Odoo 10 - Overriding unlink method
  • Code in Job's Script Block after Start-Process Does not Execute
  • Specifying Castle WCF Integration Facility Endpoint Behavior per Endpoint
  • Email verification using google app script and google forms
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • C# - Is there a limit to the size of an httpWebRequest stream?
  • Is there a amazon webstore API for customers?
  • Updating server-side rendering client-side
  • javascript inside java/jsp code
  • Javascript Callbacks with Object constructor
  • Validaiting emails with Net.Mail MailAddress
  • MySQL WHERE-condition in procedure ignored
  • Convert array of 8 bytes to signed long in C++
  • How to make Safari send if-modified-since header?
  • Web-crawler for facebook in python
  • How to pass list parameters for each object using Spring MVC?
  • RestKit - RKRequestDelegate does not exist
  • Circular dependency while pushing http interceptor
  • Is there a mandatory requirement to switch app.yaml?
  • Proper folder structure for lots of source files
  • trying to dynamically update Highchart column chart but series undefined
  • Proper way to use connect-multiparty with express.js?
  • Angular 2 constructor injection vs direct access
  • sending mail using smtp is too slow
  • Is there any way to bind data to data.frame by some index?
  • How can I use `wmic` in a Windows PE script?
  • UserPrincipal.Current returns apppool on IIS
  • java string with new operator and a literal