AnsweredAssumed Answered

I am trying to assert expected values in an excel against the actual values contained inside a json response in our project. We use array type to access the elements inside a json response. Trying to assert excel against json, so far unsuccessful.

Question asked by Maddalis on Oct 9, 2017
Latest reply on Oct 19, 2017 by Will_Truong

monikamehta4453146

For Example, a part of the json response looks like this:

 

{
"Incentives": [
{
"given": true,
"Type": "Universe/CUSTOMER/CUSTOMER",
"Incentive_Request_desc": "REQUEST_MSISDN_BLOCK"
},
{
"given": true,
"Type": "Universe/CUSTOMER/CUSTOMER",
"Incentive_Request_Desc": "CHANGE_RATE_PLAN"
},

 

Suppose I have an excel with the following values

 

Eligible         Type                                                      Dec

true         Universe/CUSTOMER/CUSTOMER         CHANGE_RATE_PLAN

 

I am trying to take each of these three values and individually assert them against their corresponding type in json response i.e. Eligible column value will be asserted against "given" field value in json response.

 

 

***************** UPDATE ************************

monikamehta4453146

 

I am using the assertion "Ensure result contains" and validating excel columns against json response populated into parameters. This works.

 

When I use scripted assertion using ".contains" or ".equals", I am getting the following error 

 

"
} execution error so we assume false: javax.script.ScriptException: bsh.EvalError: Sourced file: inline evaluation of: ``// This script should return a boolean result // indicating the assertion is t . . . '' : Typed variable declaration : Class or variable not found: splitJsonOutput.length : at Line: 17 : in file: inline evaluation of: ``// This script should return a boolean result // indicating the assertion is t . . . '' : splitJsonOutput .length
in inline evaluation of: ``// This script should return a boolean result // indicating the assertion is t . . . '' at line number 17"

 

The script does return a boolean true if "if condition" is met, else returns false on the contrary.

 

Please advise.

Outcomes