Forum Discussion

go2khurram's avatar
go2khurram
Contributor
9 years ago

java.lang.NullPointerException when testRunner.runTestStepByName("StepName") used

Hi,  I am getting java.lang.NullPointerException when I used testRunner.runTestStepByName("Update"+requiredField[j]) to run a specific step.  The script able to execute the step in test case but through error.

 

Here the copy of script

 

 

import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner

ArrayList ar = new ArrayList()
jdbcXml = context.expand('${JDBCRequestForCheckingCommandPropertyID#ResponseAsXml}')
def root = new XmlSlurper().parseText(jdbcXml)
root.ResultSet.Row.each{row->
ar.add(row["COMMANDPROPERTYID"].toInteger())
}

ArrayList requiredField = new ArrayList()
requiredField.add(61)
requiredField.add(276)
requiredField.add(605)

	for (j=0; j<requiredField.size();j++)
	{	
		if (ar.contains(requiredField[j]))
		{	
			
			
			testRunner.runTestStepByName("Update"+requiredField[j])
		
		
		}
		else
		{   
			
			
			testRunner.runTestStepByName("Add"+requiredField[j])
		}
	}
	

Regards,

 

 

 

  • Exception was occurring because one of the step was not created under test case. After creating all the required steps the Error corrected.
  • Exception was occurring because one of the step was not created under test case. After creating all the required steps the Error corrected.