charlie18
charlie18

Reputation: 3

SoapUI Groovy script not running in Testcase

I'm trying to run a Groovy script in a soapUI Test case.

The script does nothing but take the response, extract a value and use it in the next request. The extracting works when I run my script standalone. But, as soon as I try to run my test case I get following error:

ERROR:

java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.log4j.Logger at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:125) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:211) at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:47) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:138) at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:46) at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:128) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)

Even when I remove all code from my script I get the error. If I remove the whole script the test case runs without a problem. Anyone has an idea?

Upvotes: 0

Views: 412

Answers (1)

craigcaulfield
craigcaulfield

Reputation: 3538

The syntax of your assert statement isn't correct. If you're testing for null, something like the following will work:

assert !context.response: "Response Empty or Null"

It's also looks like you're using the assertion to control your script logic, but this is not a good practice. An if-then-else clause would make your intent clearer.

Upvotes: 0

Related Questions