which assertion can be used to check value of element is present from the list.

divyangdivyang Posts: 8

how do I check if a value is available from the list. for an example I want to verify a value NJ for element "state" is present in ( NJ, NY, PA, CA). I tried JSON Assertor --> String Comparison Assertion with "Element must contain" - "Expected value NJ,NY,PA,CA which did not work.



  • benken_parasoftbenken_parasoft Posts: 664 ✭✭✭
    edited September 2018

    Are you saying your JSON looks like this?


    There's more than one way of performing a validation like that. One way is to use "Occurence Assertion" with XPath like /root/item[text()="NJ"] with expected number of occurences == 1 (or >= 1, depending on what you want to check).

Sign In or Register to comment.