Menu

#692 First MockResponseTestStep fails probably if there was no mock call before.

v1.0 (example)
open
nobody
None
5
2015-12-18
2015-12-18
Heiko Studt
No

We try to start automatic testrunner with some MockResponse TestStep. After migrating to SSL we've got the following exception several times:

java.lang.NullPointerException
at com.eviware.soapui.impl.wsdl.submit.AbstractMessageExchange.<init>(AbstractMessageExchange.java:33)
at com.eviware.soapui.impl.wsdl.submit.AbstractWsdlMessageExchange.<init>(AbstractWsdlMessageExchange.java:36)
at com.eviware.soapui.impl.wsdl.panels.mockoperation.WsdlMockResultMessageExchange.<init>(WsdlMockResultMessageExchange.java:43)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlMockResponseTestStep$AssertedWsdlMockResultMessageExchange.<init>(WsdlMockResponseTestStep.java:1064)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlMockResponseTestStep.internalRun(WsdlMockResponseTestStep.java:407)
at com.eviware.soapui.impl.wsdl.teststeps.WsdlMockResponseTestStep.run(WsdlMockResponseTestStep.java:354)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:211)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:47)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:138)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:46)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:129)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:77)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.run(WsdlTestCase.java:595)
at com.eviware.soapui.tools.SoapUITestCaseRunner.runTestCase(SoapUITestCaseRunner.java:565)
at com.eviware.soapui.tools.SoapUITestCaseRunner.runRunner(SoapUITestCaseRunner.java:397)
at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:204)
at com.eviware.soapui.tools.AbstractSoapUIRunner.run(AbstractSoapUIRunner.java:139)
at com.eviware.soapui.tools.AbstractSoapUIRunner.runFromCommandLine(AbstractSoapUIRunner.java:114)
at com.eviware.soapui.tools.SoapUITestCaseRunner.main(SoapUITestCaseRunner.java:120)

Following the installed code (5.2.x) the error seems to be in:
com.eviware.soapui.impl.wsdl.teststeps.WsdlMockResponseTestStep.internalRun(WsdlMockResponseTestStep.java:407)
where the messageExchange is created even for a null getLastResult(). At the end in the inheritance hierachy this is not valid anyway.

As the "Browse SVN" link is broken, I do not see how to access the real code or debug, so this is somewhat to verify.

In my opinion the following code should be changed:

AssertedWsdlMockResultMessageExchange messageExchange = new AssertedWsdlMockResultMessageExchange(
mockRunListener.getLastResult());
result.setMessageExchange(messageExchange);

        if (mockRunListener.getLastResult() != null) {
            lastResult = lastResultTemp;
            mockResponse.setMockResult(lastResult);

            context.setProperty(AssertedXPathsContainer.ASSERTEDXPATHSCONTAINER_PROPERTY, messageExchange);
            assertResult(lastResult, context);
        }

into

        WsdlMockResult lastResultTemp = mockRunListener.getLastResult();
        if (lastResultTemp != null) {
            AssertedWsdlMockResultMessageExchange messageExchange = new AssertedWsdlMockResultMessageExchange(
                    lastResultTemp);
            result.setMessageExchange(messageExchange);
            lastResult = lastResultTemp;
            mockResponse.setMockResult(lastResult);

            context.setProperty(AssertedXPathsContainer.ASSERTEDXPATHSCONTAINER_PROPERTY, messageExchange);
            assertResult(lastResult, context);
        } else {
             result.setMessageExchange(null); //TODO: Really?
        }

Discussion


Log in to post a comment.