Forum Discussion

ChaitanyaC's avatar
16 years ago

Java.Lan.NullPointer Exception Cannot invoke method :SetPropertyValue() error

Hi,

I'm currently new to SOAP UI PRO and evaluating it for my project.I tried executing the below groovy script but it throws an execption ,Java.Lan.NullPointer Exception Cannot invoke method :SetPropertyValue 

do I need to set any class paths to make this script work?

log.info("In the WeatherTestCase Setup Script")
props = new java.util.Properties()
fis = new FileInputStream ("C:/Basic/testprops2.txt")
props.load (fis)
today = props.getProperty ( "today" )
zipCode = props.getProperty ( "zipCode" )
targetStep = testRunner.testCase.getTestStepByName( "Properties" )
// transfer all properties
targetStep.setPropertyValue( "startDate", today)
targetStep.setPropertyValue( "zipCode", zipCode)
log.info(today)
log.info(zipCode)

1 Reply

  • Hello,

    I don't see anything that looks wrong with your script. The NullPointerException suggests that the value of targetStep is null, meaning that testRunner.testCase.getTestStepByName( "Properties" ) is returning null. Please double check to make sure that there is a TestStep in the same TestCase as the Groovy TestStep with the name "Properties" (capitalization matters). You can add the following line to your code to verify that you get a TestStep before you try to transfer the properties:


    //Insert this after targetStep = testRunner.testCase.getTestStepByName( "Properties" )
    log.info("targetStep is "+targetStep)
    //Should print something like: Tue Mar 23 13:11:18 CET 2010:INFO:targetStep is com.eviware.soapui.impl.wsdl.teststeps.WsdlPropertiesTestStep@1de57c


    Regards,
    Dain
    eviware.com