Forum Discussion
Hey nmrao
again my attempt at the code looked completely different to yours!
Thanks man - it works great - but I have a question - regarding the second assertion below
//Code courtesy of Rao
//assumes json object is defined already def areAllSiblingValuesMatching = { key, value, condition -> def actalValues = json.data.findAll(condition).collect {it."$key"}.unique() (1 == actalValues.size() && value == actalValues.first() ) ? true : false } //verify date value and status name is Registered assert areAllSiblingValuesMatching('RegistrationFromDate', '2019-03-29 00:00:00.000'){ it.GeographicalIndicationStatusId_Name == 'Registered'} //verify date value and status name is not Registered - THIS IS THE SECOND ASSERTION assert areAllSiblingValuesMatching('RegistrationFromDate', null){ it.GeographicalIndicationStatusId_Name != 'Registered'}
If there are no records in the dataset where GeographicalIndicationStatusId_Name != 'Registered - I get an assertion failure on this.
When I execute the step when the resultset DOES have >=1 row where GeographicalIndicationStatusId_Name != 'Registered' - the step PASSES
Is there something I can do to tweak this for scenarios where the resultset does NOT contain records where GeographicalIndicationStatusId_Name != 'Registered' ???
Thanks man - do you fancy a job? I need some help at my place! :)
cheers,
richie
What is expected in below case? Is the response expected to meet that condition?
If there are no records in the dataset where GeographicalIndicationStatusId_Name != 'Registered - I get an assertion failure on this.
Otherwise, it is ok not to have additional assertions which are not expected.
Related Content
- 2 years agoMarcusBengtsson
- 6 years agoJakemorley
- 6 years agoDainiusA
- 6 years agotrajmo