cancel
Showing results for 
Search instead for 
Did you mean: 

Set a JSONPath expression parameter from a datasource

SOLVED
Contributor

Re: Set a JSONPath expression parameter from a datasource

 

 

Is there a way to wrap some logic around this to say if the record does not exist then skip?

 

The is an outer join in the DB query which means that sometimes there may not be any data and I would not want the Assertion to trigger.

 

Suggestions?

 

 

 

Community Hero

Re: Set a JSONPath expression parameter from a datasource

Hi @cst99003

 

You'll need some groovy to do this as far as I can tell.  The Assertion is on the test step and will fire as soon as the step executes so im guessing the assertion will execute as soon as the outer join executes.  one for the groovy scripters I think!

 

As an aside - going back to the 'fix' @Lucian supplied - can you confirm what it's doing?  I've never seen >1 JSONPATH in the expression section of a JSON Content Assertion before and would welcome the education!

 

Lucian's update to your Assertion was as follows:

 

JSON EXPRESSION
$['CalculatedOptions'][0]['RetirementDate']

$.CalculatedOptions[${Datasource#CALCOPT_CNT}].RetirementDate

EXPECTED RESULT
${Datasource#RO_RETIREMENTDATE}

So - your expected result is a value set in your Datasource and I'm guessing you are asserting that two attributes in yoru response match the RO_RETIREMENT property.

 

HOWEVER - I don't understand what the following is actually doing:

$.CalculatedOptions[${Datasource#CALCOPT_CNT}].RetirementDate

Thankyou! - Sorry I couldn' t be more help!

 

 

rich

if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the title of the post to something more descriptive? This will help people when searching for problems.
New Here?
Join us and watch the welcome video:
Top Kudoed Authors