cancel
Showing results for 
Search instead for 
Did you mean: 

Assertion Test step gets False Failure

mayankchugh
Occasional Visitor

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!

Tags (3)
1 REPLY 1
nmrao
Community Hero

Re: Assertion Test step gets False Failure

Not sure of your use case exactly.

see if context.response helps.


Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors