Integration With Java Applications

Applies to ReadyAPI 3.53, last modified on June 26, 2024

To integrate ReadyAPI tests in your Java applications, add the ReadyAPI libraries to your project and then call the needed methods from your code.

ReadyAPI tests can also be run from popular test frameworks, such as JUnit or TestNG.

Prepare for Running ReadyAPI Tests

To prepare your application for running ReadyAPI tests, you need to import the ReadyAPI libraries to your project:

  • If you use Maven, add the following dependencies to your pom.xml file:




-- or --

  • Manually import .jar files from the <ReadyAPI installation directory>\lib folder to your application project.

After that, you can use the ReadyAPI Runner classes to run your tests.

Available Classes

Your tests have access to the following classes:

Class Description
SoapUIProTestCaseRunner Contains methods you use to work with functional tests.
SoapUIProSecurityTestRunner Contains methods you use to work with security tests.
LoadUIProjectRunner Contains methods you use to work with load tests.
SoapUIMockServiceRunner Contains methods used to start and stop virtual APIs.

Starting Tests

To start your ReadyAPI tests, use the following code:



public void Test() {
    try {
        // Create a test runner object
        SoapUIProTestCaseRunner runner = new SoapUIProTestCaseRunner();

        // Specify the path to the project file

        // Specify the test suite to run
        runner.setTestSuite("Test Suite 1");

        // Specify the test case to run
        // It must be in the test suite specified above
        runner.setTestCase("Test Case 1");

        // Command the runner to create a printable report

        // Start the test run;
    // Handle the exception, if any
    catch (Exception e){

Reporting and Exporting Functional Web Service Tests

Runner classes support creating reports for a tests run. To do this, enable the option to create a report and set the report output folder:


// Create the runner object
SoapUIProTestCaseRunner runner = new SoapUIProTestCaseRunner();


// Run the test
// Command the runner to create JUnit-style report

// Command the runner to create printable report

// Command the runner to open the created report

// Specify the folder to save the report in

// Run the test;

Exported files have the following names: <TestSuite>-<TestCase>-<TestStep Name>-<Count>-<Status>.txt. They will appear in the report folder you have specified.

For example, you can have the following file: TestSuite 1-TestCase 1-Request Step 1-0-OK.txt. If you run the test step several times during the test case run, ReadyAPI will save each run as an individual file.

The response attachments will also appear in the report folder. They will have the following name template: <TestSuite>-<TestCase>-<TestStep Name>-<Count>-attachment-<AttachmentCount>.<Extension>. By default, they will have a format matching the content-type. If it is not available, ReadyAPI will save the attachment in .dat format.

See Also


Highlight search results