SoapuUI.setSoapUICore causing Junit threads to end

83 views Asked by At

I have a Maven/Junit test project that I'm running in concurrent mode. Each test case calls a web service using the SoapUI API:

public void makeWebServiceCall(String testCaseName) {
    SoapUI.setSoapUICore( new StandaloneSoapUICore(true) );
    WsdlProject project = new WsdlProject("mySoapUiProject.xml");
    WsdlTestSuite testSuite = project.getTestSuiteByName("myTestSuite");
    WsdlTestCase testCase = testSuite.getTestCaseByName(testCaseName);
    WsdlTestCaseRunner testCaseRunner = testCase.run(new PropertiesMap(), false);
    ...
}

After much debugging, I've found that the statement

SoapUI.setSoapUICore( new StandaloneSoapUICore(true) );

often causes the Junit thread making the call to end, with the rest of the test case being completed by a later thread. When this happens, the original thread's resources aren't released properly and the later thread that completes the code does so sequentially for each of the interrupted threads, so the benefits of concurrent execution are lost.

I haven't been able to find any documentation on what this SoapUI.setSoapUICore method does or why it might cause the Junit thread to exit. I guessed it might be a resource locking issue as setSoapUICore is a static method. But I've tried synchronizing the soapUI code so that only one thread can execute it at a time and the problem persists.

So instead I placed the call inside a static initializer block for the class so that it only gets called once:

static {
    SoapUI.setSoapUICore( new StandaloneSoapUICore(true) );
}

That seems to have fixed the problem, but I'd like to know what this method is doing that might cause the Junit thread to end and therefore, if the above "fix" is indeed a viable solution.

I'm using the following resources:

  • Maven 3.6.1
  • Maven Surefire 3.0.0-M4
  • Junit-Jupiter 5.7.0-M1
  • Java 13.0.1
  • SoapUI 5.5.0
0

There are 0 answers