How to get the response by JUNIT with SOAPUI

I'm running my SOAPUI project from Eclipse. When project is executed I need to show the response of a specific testStep in Eclipse.

How can I do it?


You can get the context using your TestRunner instance and then use expand method to get your property. In your case:

WsdlProject project = new WsdlProject( "/path/to/Soapui/project.xml" );
TestSuite testSuite = project.getTestSuiteByName( "testSuiteName" );
TestCase testCase = testSuite.getTestCaseByName( "testCaseName" );
TestRunner runner = PropertiesMap(), false );
assertEquals( Status.FINISHED, runner.getStatus() );
// get context and expand the properties
runner.getRunContext().expand("${Test Request#Response}")


For more info you can check the API: TestRunner.getRunContext() and TestRunContext.expand(java.lang.String)

Note that to use expand, the first part of the String passed is the testStep name and the second part is the property you want to get: ${testStepName#Property}.

In your case to get the Response you can use ${Test Request#Response}.

If as you comment instead of the whole response you want to get a node value you can apply an XPath using expand with the follow notation:


So for your case to get the value of <STATUS_MSG> you can do it with:

${Test Request#Response#//*:STATUS_MSG}

Hope it helps,

Need Your Help

Object.freeze doesnt prevent object from being reinitialized?

javascript security object

Working on some script for an application - I'm not trying to make my client-side code secure, but I am trying to put in enough security that anyone with a console can't walk by and effortlessly

Solr Mulivalued Problem

json solr multivalue

Consider The following is the json response i'm getting from the solr if i use multivalued = true for the fields.