Forum Discussion

CHIMERA's avatar
CHIMERA
Occasional Contributor
10 years ago

Run SoapUI tests through Java

I need to run a SoapUI Test project through Java and get the Exit Code of that run.

I have tried using the below LOC:

 

Runtime.getRuntime().exec(new String[]{"C:/Program Files (x86)/SmartBear/SoapUI-Pro-5.0.0/bin/testrunner.bat","-EDefault","D:/Projects/UAT-soapui-project.xml"});

 

But this fails to work if the execution encounters any errors, i.e., if the test has any errors, the code just keeps running infinitely, niether returns a Exit Code.

I have also tried running a batch file through Java, which contains command line instructions to run the tests, but the Java code returns the Exit Code for the batch file and not for the test executed using the batch file.

Please provide a solution.