Forum Discussion

arkade's avatar
arkade
New Contributor
15 years ago

Can't add REST request in test case

Hi,
Using SoapUI 3.6.1, I ran into same problem as listed here viewtopic.php?f=2&t=4462&start=15 (which I named this topic after).
I downloaded the 3.6.2 nightly and retried. No fix.
OOI, by opening the project XML in Eclipse, I can see that despite throwing the same error, if I save, the new testStep does appear in the XML. I've tried "Resolve" (no errors), loading and reloading, restarting SoapUI. No help.
Any suggestions welcome.
Thanks, R.

1 Reply

  • arkade's avatar
    arkade
    New Contributor
    To clarify the problem some more and supply a workaround ...

    The problem seems to happen when using resources to add parameters to methods.

    Project structure explanation:
    A set of methods M1 all take parameters x, y & z. Rather than creating x, y & z in every method in M1, create a resource R1 with parameters x, y & z and place all M1 methods under it. (they'll then automatically have parameters x, y & z).
    Another set of methods M2 take all M1 parameters and also all take parameter w. Create resource R2 under R1 and place M2 under R2. (M2 methods will then automatically have parameters w, x, y & z).

    The following image shows this structure at the bottom where Resource "task-based" has 3 parameters that setUrl() (and its imminent siblings) all use). (In case you're curious, the API is RememberTheMilk.com, calls all share the same path and are distinguished by the "method" parameter.)



    Workaround:
    I recreated the troublesome method (setUrl in this case) outside my structure with all the parameters and retried adding to my testcase -- it worked fine.

    Source:
    I checked the source briefly when the problem happens...


    Thu Apr 21 11:20:58 BST 2011:ERROR:java.lang.NullPointerException
    java.lang.NullPointerException
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.ensureUniqueName(WsdlTestCase.java:312)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.insertTestStep(WsdlTestCase.java:503)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.insertTestStep(WsdlTestCase.java:494)
    at com.eviware.soapui.impl.wsdl.panels.testcase.WsdlTestCaseDesktopPanel$AddWsdlTestStepAction.run(WsdlTestCaseDesktopPanel.java:698)


    310 private boolean ensureUniqueName( WsdlTestStep testStep )
    311 {
    312 String name = testStep.getName();


    It's the top of ensureUniqueName() suggesting the testStep argument is null.

    497 public WsdlTestStep insertTestStep( TestStepConfig stepConfig, int ix, boolean clearIds )
    498 {
    499 TestStepConfig newStepConfig = ix == -1 ? getConfig().addNewTestStep() : getConfig().insertNewTestStep( ix );
    500 newStepConfig.set( stepConfig );
    501 WsdlTestStep testStep = createTestStepFromConfig( newStepConfig );
    502
    503 if( !ensureUniqueName( testStep ) )


    So something went awry with createTestStepFromConfig().

    295 private WsdlTestStep createTestStepFromConfig( TestStepConfig tsc )
    296 {
    297 WsdlTestStepFactory factory = WsdlTestStepRegistry.getInstance().getFactory( tsc.getType() );
    298 if( factory != null )
    299 {
    300 WsdlTestStep testStep = factory.buildTestStep( this, tsc, forLoadTest );
    301 return testStep;
    302 }
    303 else
    304 {
    305 logger.error( "Failed to create test step for [" + tsc.getName() + "]" );
    306 return null;
    307 }
    308 }


    Assuming logger.error() would show in SoapUI's "error log" or "soapUI log" tabs and that error not seen, conclude that successfully got a factory but it built a null testStep.

    I haven't built from source to take this further but hopefully the above will help (a) others get past this problem and/or (b) help Eviware fix the bug / recommend against this practise if considered bad :-)

    Thanks & HTH, Rupert.