Forum Discussion

tdrury's avatar
tdrury
Contributor
11 years ago

Running _Pro_ TestCase via Java?

The online help shows an example of running a TestCase in Java:

WsdlProject project = new WsdlProject( "src/dist/sample-soapui-project.xml" );
TestSuite testSuite = project.getTestSuiteByName( "Test Suite" );
TestCase testCase = testSuite.getTestCaseByName( "Test Conversions" );

// create empty properties and run synchronously
TestRunner runner = testCase.run( new PropertiesMap(), false );
assertEquals( Status.FINISHED, runner.getStatus() );


However, my TestCase uses Datasources - a Pro feature - and when running this code the datasource entries are not resolved into my requests. I see in the Pro javadocs there is a WsdlProjectPro class, but just changing this was not enough. I don't see an equivalent Pro classes for TestSuite, TestCase, or TestRunner. How do I run this example on a soapui Pro TestCase?

Note: I don't want to use SoapUIProTestCaseRunner because I need access to the TestCase context after the test has run.

Thanks,
-tim

2 Replies

  • I got this working by doing this:

    SoapUIPro.SoapUIProCore soapuiCore = new SoapUIPro.SoapUIProCore(true, "src/test/resources/soapui-settings.xml", null);

    I'm not sure if that's the right way to get the soapui internals running Pro features....

    Bonus: it lets me load settings also which basically answers my other question in the other thread. If this is the "right" way, I'll update that thread with whatever answer I hear back from SmartBear.

    -tim
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hey Tim,

    Usually, I would recommend you to use the SoapUIProTestCaseRunner, but since you want to avoid using it in order to be able to access the context, then your solution is fine.

    Let me know if you have any other questions!

    Regards,
    Arian
    SmartBear Sweden