NPE in groovy test step
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2011
11:17 PM
11-17-2011
11:17 PM
NPE in groovy test step
Hi I have some test step. And when soapui run groovy script there is NPE but I dont know why:
08:14:15,600 ERROR [SoapUI] An error occured [java.lang.NullPointerException], see error log for details
08:14:15,601 ERROR [AbstractTestRunner] Exception during Test Execution
java.lang.NullPointerException
at com.eviware.soapui.report.JUnitReportCollector.afterStep(JUnitReportCollector.java:168)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:244)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:48)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:141)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:42)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:135)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
this is all I have
08:14:15,600 ERROR [SoapUI] An error occured [java.lang.NullPointerException], see error log for details
08:14:15,601 ERROR [AbstractTestRunner] Exception during Test Execution
java.lang.NullPointerException
at com.eviware.soapui.report.JUnitReportCollector.afterStep(JUnitReportCollector.java:168)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:244)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:48)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:141)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:42)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:135)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
this is all I have
7 REPLIES 7
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2011
12:54 AM
11-18-2011
12:54 AM
Hi!
hmm... can you show the contents of the groovy script?
regards!
/Ole
SmartBear Software
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
hmm... can you show the contents of the groovy script?
regards!
/Ole
SmartBear Software
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2011
03:57 AM
11-18-2011
03:57 AM
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def response = context.expand( '${Request#Response}' )
def holderResponse = groovyUtils.getXmlHolder( response )
def listElement = []
int countElement1 = Integer.parseInt (holderResponse.getNodeValue( "count(//*[local-name()='element1' and namespace-uri()='cz:v1'])") )
for(int i = 1; i <= countElement1; i++){
listElement.add( holderResponse.getNodeValue( "//*[local-name()='element1' and namespace-uri()='cz:v1'][" + i + "]" ) )
listElement.add( holderResponse.getNodeValue( "//*[local-name()='element1' and namespace-uri()='cz:v1'][" + i + "]/@atribut" )
}
Collections.sort(listElement)
def response = context.expand( '${Request#Response}' )
def holderResponse = groovyUtils.getXmlHolder( response )
def listElement = []
int countElement1 = Integer.parseInt (holderResponse.getNodeValue( "count(//*[local-name()='element1' and namespace-uri()='cz:v1'])") )
for(int i = 1; i <= countElement1; i++){
listElement.add( holderResponse.getNodeValue( "//*[local-name()='element1' and namespace-uri()='cz:v1'][" + i + "]" ) )
listElement.add( holderResponse.getNodeValue( "//*[local-name()='element1' and namespace-uri()='cz:v1'][" + i + "]/@atribut" )
}
Collections.sort(listElement)
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2011
03:59 AM
11-18-2011
03:59 AM
hm maybe I found where is the mistake. Sometimes in this list is null object and when I want to sort it there is NPE but I dont know why it print this exception and groovy didnt tell me row where is mistake
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2011
04:23 AM
11-18-2011
04:23 AM
Hi,
yes, that makes sense - maybe you can avoid adding null items to the collection somehow?
regards!
/Ole
SmartBear Software
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
yes, that makes sense - maybe you can avoid adding null items to the collection somehow?
regards!
/Ole
SmartBear Software
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2011
10:38 PM
11-20-2011
10:38 PM
yea there is null but why it show this exception so I cannot see my fault immediately ?
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2011
03:16 AM
11-21-2011
03:16 AM
Hi,
you are of course right - it is a bug in soapUI to not handle this correctly - I've added it to the backlog for fixing.
regards!
/Ole
SmartBear Software
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
you are of course right - it is a bug in soapUI to not handle this correctly - I've added it to the backlog for fixing.
regards!
/Ole
SmartBear Software
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2011
05:32 AM
11-21-2011
05:32 AM
thx
