Forum Discussion

rg2018's avatar
rg2018
Occasional Contributor
6 years ago
Solved

Assert Script

I need to verify via script assertion that within "SimpleList" that

SimpleName1 with "outcome": "Met"

SimpleName2 with "outcome": "Met

.

.

.

etc......

 

I'm able to output SimpleName1, SimpleName2 etc but for verification I need both

SimpleName1 with the "outcome": "Met" in order for my assertion to pass. Also I'd like to be able to filter my assertion, so for example only validate within SimpleList that "SimpleName1" "outcome": "Met" and  "SimpleName4" "outcome": "Met" and just ignore the rest.

 

 

sample response:

"SimpleList": [
{
"SimpleName": "SimpleName1",
"outcome": "Met"
},
{
"SimpleName": "SimpleName2",
"outcome": "Met"
},
{
"SimpleName": "SimpleName3",
"outcome": "Met"
},
{
"SimpleName": "SimpleName4",
"outcome": "Met"

  • Hi rg2018,

     

    If it is understood to you that everytime your "outcome" value remains same then you can store this in properties and validating it using json slurprer in script assertion.

     

    Click "Accept as Solution" button if my answer has helped, and remember to give "kudos" :)

     

    Thanks,

    Himanshu Tayal

1 Reply

  • Hi rg2018,

     

    If it is understood to you that everytime your "outcome" value remains same then you can store this in properties and validating it using json slurprer in script assertion.

     

    Click "Accept as Solution" button if my answer has helped, and remember to give "kudos" :)

     

    Thanks,

    Himanshu Tayal