Forum Discussion

Kathryn_O_Malle's avatar
Kathryn_O_Malle
Contributor
16 years ago

SoapRequest / Mock Response pairs and scope rules...

Hi,

I've been working on a modular script setup in SoapUI 3.5 Pro which can handle multiple variations of message.
Basically the steps to generate each of the different messages, including the Soap Test Request to submit the actual message are always the same. The differences come with the Mock Responses and the assertions required to validate the return messages.
For instance -

// Generate and submit message
Test_Case_Generic_Generate_XML_Message
steps to generate message content
step to submit message

// One of mutliple scenarios...
Test_Case_Response_Scenario_One
Mock response step (unique bits for each scenario)

//Controlling test case
step to call Test_Case_Generic_Generate_XML_Message
Test_Case_Response_Scenario_One
  [using control logic select mock response test case to call]


I have a controlling test case which calls the above two testcases. It runs fine until it hits the Mock Response step when I get a:
[tt:12qj93uq]ERROR [AbstractTestRunner] Exception during Test Execution java.lang.NullPointerException at com.eviware.soapui.impl.wsdl.teststeps.wsdlMockResponseTestStep.internalRun(wsdlMockResponseTestStep.java:393)...
[Set of additional lines not copied][/tt:12qj93uq]

My suspicision is that "scope rules" have caused the error, i.e. as the test case containing the submit message step has fully completed, when I come to try and create the mock response step it will fail as the reference to the submit message step has disappeared. Hopefully that makes sense as I'm not sure what has happened here...

Is there a way to do the modular scenario I describe at the start? Perhaps by creating the mock response text in a routine and store it in the actual mock response step by property expansion? But then is there a way to define the various assertions needed?

Hopefully the above makes sense...

Thanks
Adam

2 Replies

  • Hi Adam,

    hmm.. could you start by upgrading to the 3.5.1 nightly build just to get a correct error line so I can see where exactly this is failing?

    regards!

    /Ole
    eviware.com
  • Hi,

    Not the answer I was expecting, thought it was going to be "you can't do that" but...

    I've downloaded the latest nightly build, soapui-pro-3.5.1-win32-standalone-bin.zip, think that is the right one for our setup (Win XP SP2, 32 bit).

    In the interim I've also tried a couple of variations with interesting results...

    Variation One:
    Both the step to submit the message and the corresponding mock response step are in a separate testcase
    this separate testcase is called from the controlling testcase
    Used the "Run TestCase" step in this variation
      Result:I still get an error when it reaches the mock response step

    Variation Two:
    Both the step to submit the message and the corresponding mock response step are in a separate testcase
    this separate testcase is called from the controlling testcase
    Created a groovy script teststep which uses "def testCase = testRunner.testCase.testSuite.testCases[""]
      Result: It works...

    Will update after nightly build installed.