Forum Discussion

kahhoet's avatar
kahhoet
New Contributor
9 years ago

Invoking SoapUI Test Cases From Code

Hi,
 
We have a number of test cases created in SoapUI and we would like the test cases to be invoked via code. Is there a Java library where we could reference in code and reuse the test cases that we have previously created via SoapUI?
 
Sample use case as follows:
 
List<SoapUIRequest> requests = SoapUIRequestLoader.load(“previously_created_soapui_testcases.xml”);
SoapUITestRunner runner = new SoapUITestRunner();
 
For (SoapUIRequest req : requests) {
Boolean pass = runner.runTest(req);

// Some logic here.
}
 
Thanks

3 Replies

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    Do you mean something like this:

     

    SoapUITestCaseRunner testRunner = new SoapUITestCaseRunner();
    testRunner.setProjectFile("soapui-project.xml");
    testRunner.setTestCase("your test case"); testRunner.run();

    ?

     

    Regards,

    Rupert

     

    • kahhoet's avatar
      kahhoet
      New Contributor

      Yeah. Sort of. Is there such a library?

      • rupert_anderson's avatar
        rupert_anderson
        Valued Contributor

        Hi,

         

        Can you come a little closer than 'sort of' please? Like, you want to run a TestCase using Java code, but the code I suggested is right or wrong for your purpose in some way?

         

        In terms of libraries, that code example I suggested would require that you include the SoapUI library e.g. soapui-5.2.1.jar as a dependency.

         

        Regards,

        Rup