Forum Discussion

mayankchugh's avatar
mayankchugh
Occasional Visitor
8 years ago

Assertion Test step gets False Failure

Hi,

 

I am new to SoapUi and ran into some troubles for which I could not find an answer in already discussed topics. It may sound stupid, but here it goes.

 

I have a test case with a Datasource, a request, an assertion step, DataSink and DataSourceLoop.

 

The Request has a couple of assertions - Http Valid Codes (200) and a script assertion with below script:

 

import groovy.json.JsonSlurper
def response = messageExchange.response.responseContent
def slurper = new JsonSlurper()
def json = slurper.parseText response

assert json.items.size > 0

 

 

Same assertions are added in the assertion script as well.

 

Now the issue is: assertion added in request holds valid when the script is run. However, when the test case is run, the assertions in Assertion test case fail with errors:

Status Code extraction failed

Cannot read property responsecontent from null object

 

 

I fail to understand why the same assertion is working when applied in the script but fails when added in the test case.

 

Any leads on the issue would be of great help.

 

Thanks!