MNeidt
14 years agoNew Contributor
NullPointerException when logging HTTP Request results
Hello,
I encountered a NullPointerException and suppose this is a bug (if it's something I've done wrong I am sure you will tell me :-) ).
The situation is as follows:
- TestCase A sends an HTTP request (not SOAP) to a remote server
- TestCase B calls A and provides some parameters (A is a generic test case)
- in the project settings I created an afterStep event that logs the outcome of each test step, just as proposed here: http://www.soapui.org/Scripting-Propert ... ng-results
When I call TestCase B, a NullPointerException is being thrown during the logging event as follows:
Some more information:
- The Exception does not occur when I run TestCase A directly, nor on any other test step type.
- This seems to be independent of the utilized HTTP method (tested GET and POST).
- I also have a similar situation in the same project where I use a SOAP request instead of HTTP. There it does work, so the problem is limited to the HTTP Test Request step.
- The HTTP request for now simply targets an Apache Tomcat index page, so there is a valid HTML response.
- soapUI version is 4.0.1 pro (Build dist-142-2011-09-14, Build Date 2011/09/14 13:38)
Thank you in advance for your help. Please let me know if you need further information.
I encountered a NullPointerException and suppose this is a bug (if it's something I've done wrong I am sure you will tell me :-) ).
The situation is as follows:
- TestCase A sends an HTTP request (not SOAP) to a remote server
- TestCase B calls A and provides some parameters (A is a generic test case)
- in the project settings I created an afterStep event that logs the outcome of each test step, just as proposed here: http://www.soapui.org/Scripting-Propert ... ng-results
filePath = 'c:/testresults'
fos = new FileOutputStream( filePath + testStepResult.testStep.label + '.txt', true )
pw = new PrintWriter( fos )
testStepResult.writeTo( pw )
pw.close()
fos.close()
When I call TestCase B, a NullPointerException is being thrown during the logging event as follows:
Mon Mar 19 11:14:42 CET 2012:ERROR:java.lang.NullPointerException
java.lang.NullPointerException
at java.lang.String.<init>(Unknown Source)
at com.eviware.soapui.impl.wsdl.teststeps.RestRequestStepResult.writeTo(RestRequestStepResult.java:210)
at com.eviware.soapui.model.testsuite.TestStepResult$writeTo.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at com.eviware.soapui.model.testsuite.TestStepResult$writeTo.call(Unknown Source)
at Script62.run(Script62.groovy:8)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:88)
at com.eviware.soapui.eventhandlers.support.DefaultSoapUIScript.invoke(SourceFile:47)
at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(SourceFile:29)
at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(SourceFile:73)
at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(SourceFile:49)
at com.eviware.soapui.eventhandlers.impl.EventHandlersTestRunListener.afterStep(SourceFile:41)
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)
Some more information:
- The Exception does not occur when I run TestCase A directly, nor on any other test step type.
- This seems to be independent of the utilized HTTP method (tested GET and POST).
- I also have a similar situation in the same project where I use a SOAP request instead of HTTP. There it does work, so the problem is limited to the HTTP Test Request step.
- The HTTP request for now simply targets an Apache Tomcat index page, so there is a valid HTML response.
- soapUI version is 4.0.1 pro (Build dist-142-2011-09-14, Build Date 2011/09/14 13:38)
Thank you in advance for your help. Please let me know if you need further information.