Forum Discussion

alfonsolft's avatar
alfonsolft
Occasional Contributor
7 years ago

Pass a parameter to a REST service


I have the following groovy script


//-------------------------- Usuario ------------------------------------------------------
// create dialog
def dialog = com.eviware.soapui.support.UISupport.createConfigurationDialog( "Campo Usuario" );
dialog.addTextField( "usuario", "usuario" );
// init values and show
def map = new java.util.HashMap();
map.put( "usuario", "" );
if( dialog.show( map ))
{
// get target step
def step = testRunner.testCase.getTestStepByName( "Properties" );
// assign
step.setPropertyValue( "usuario", map.get( "usuario" ));
}
else testRunner.cancel( "Campo usuario no encontrado" );

 


but when I executed it .The script shows me the next message

 

"java.lang.NullPointerException:Cannot invoke method setPropertyValue() on null object error at line:13"


I would like to pass the "usuario" parameter to the followings services REST .How can implement it?

 

Thanks for all you help!!

  • Do you have TestStep name "Properties" in the same test case as the groovy script?

    If you rename or move the test step that would cause the error.

2 Replies

  • PaulMS's avatar
    PaulMS
    Super Contributor

    Do you have TestStep name "Properties" in the same test case as the groovy script?

    If you rename or move the test step that would cause the error.