Showing results for 
Search instead for 
Did you mean: 

How to transfer a message from an Assertion to a DataSink

Occasional Contributor

How to transfer a message from an Assertion to a DataSink

I am a Ready! API (1.4.1) SoapUI NG user and I need help regarding the transfer of a message from an Assertion to a DataSink.


Here is my scenario.


I run a web service thay returns all the products a client may have. There may be more than one element return and his 'Health' product may be returned in anyone. I cannot tell in which element it will be, if it even exists.


Health 1.jpg


In this case it is in the second element.

Health 2.jpg


Ultimately, I have an assertion to check whether the word 'Health' is found anywhere with the returned XML. Here I am doing it with an Assertion Step. I am not failing the Assertion as I only want to know whether a client has Health or not. I want to continue with the DataLoop but I want a report where I write the Message from the Assertion to a file next to the Client Number.


Health 3.jpg


So Property Transfer offers me the chance to use the Assertion as Source, but I cannot choose a Property from the Assertion. The Property dropdown is disabled.

Health 4.jpg


So ultimately, I just want a result to be returned. Whether it is the Test Step passed or failed, or the Assertion status, or anything that can tell me whether I found the value or not.


Any assistance will be greatly appreciated.


Health 5.jpg

Community Manager

Re: How to transfer a message from an Assertion to a DataSink

Hi Yakima,


As you don’t know the exact response those value you want to write to a file, I would suggest that you create your own script that will search for the needed value in the entire request and post the results to a file. You can find a sample of how to work with Excel via Groovy here or here.

Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Occasional Contributor

Re: How to transfer a message from an Assertion to a DataSink

Thank you very much.


Personally, I would like to keep my scripts as simple as possible and refrain from Groovy Scripts where there is not other way around. It makes it easier to maintain by not so technical resources.


Since this Groovy script was a solution, I would expect the functionality to be built in to easy transfer the message from the assertion to a parameter to be written to the Data Sink.


This script worked for me. I'm storing the result in a global variable and reading it from the Data Sink.


def testStep = testRunner.testCase.getTestStepByName('TestStepName')
// print assertion names an its status
    com.eviware.soapui.model.propertyexpansion.PropertyExpansionUtils.globalProperties['testResult'].value = "$it.label - $it.status"   

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