Forum Discussion

VernonCrabtree's avatar
VernonCrabtree
Occasional Contributor
9 years ago

How to run a Test case from Java and be able to set and retrieve properties and see report

SoapUI is a great product for managing Soap and Rest messaging in the context of testing.

I want to support the use of existing and future SoapUI Pro tests within our chosen test framework - but I have an issue that is driving me crazy.  The alternative is to not use SoapUI Pro at all - which is not my objective at all.

 

I am trying to run a Test case from Java and be able to set and retrieve properties and see report output.

I see examples of some of these elements here:

https://support.smartbear.com/readyapi/docs/testing/integrations/junit.html

 

These examples seem to be out-of-date - or is that just me?

 

The link to the SoapUIProTestCaseRunner is to: https://soapui.org/apidocs/pro/com/eviware/soapui/SoapUIProTestCaseRunner.html#_ga=2.53884712.1072604993.1494427979-1195040155.1434438474

 

However the example uses: import com.smartbear.ready.cmd.runner.pro.SoapUIProTestCaseRunner;

 

SoapUIProTestCaseRunner is good to run the test case and see the report - but I cannot set the properties or retrieve the results.

 

The next description: "To have more control over integration and error reporting, run a specific test case:" seems to suggest that the same as SoapUIProTestCaseRunner but with more control is possible.  Unfortunately, this does not seem to be the case.

I can do this call: testCase.run(new PropertiesMap(), false)

. . . and the test case runs - but when a step fails - how do I find out which step or which assertion failed?

 

Also - any steps involving Pro features (e.g. reading data from Excel) fails with reason: "Cancelling due to failed test step" - but which step failed?

 

Looking through the API, I see this:

https://soapui.org/apidocs/pro/index.html?com/eviware/soapui/SoapUIProTestCaseRunner.html

 

SoapUIProTestCaseRunner seems to offer the useful runTestCase method: https://soapui.org/apidocs/pro/com/eviware/soapui/SoapUIProTestCaseRunner.html#runTestCase(com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase)

https://soapui.org/apidocs/pro/com/eviware/soapui/SoapUIProTestCaseRunner.html#runTestCase(com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase)

SoapUIProTestCaseRunner also looks to have helpful reporting methods.

 

I cannot find the SoapUIProTestCaseRunner object in the versions of SoapUI that I have (1.5; 1.6).

 

Further, I have found the use of this code:

SoapUIPro.SoapUIProCore soapuiCore = new SoapUIPro.SoapUIProCore(true, "/path/to/soapui-settings.xml");

 

Which might be helpful, but I cannot find the class SoapUIPro.SoapUIProCore - only the SoapUIProCore interface.

 

Please, can someone suggest what combination of objects/methods in current versions of SoapUI Pro can be used to both run specific test cases - giving report output - and access the properties?

I need to see the imports - my Java skills are a bit dusty and I am yet to learn how to search through Jars (something like using Oops! I think)!

Attached is my existing attempt.

Thank you