Forum Discussion

AAB's avatar
AAB
Regular Contributor
6 years ago

Assertions: check that number of response is bigger then 10

Hi,

 

Could someone tell me how  I could add an XPath that says:

Response contains > 10 answers, not knowing what the answers are but one is expecting more then 10?

 

Thanks in advance,

Kind regards,

AboveAndBeyond

  • Hey AAB

    ah - when I responded I hadn't seen Nastya_Khovrina's response.

     

    The json count assertion works only for a specific value - you can't specify any maths operators like >, < to say that a node has >10 records in there - this was the first thing I checked when I saw your post.

     

    HOWEVER - the XPATH which Nastya_Khovrina has provided IS what you need - right?

     

    I did try and view the .xml you attached to identify the repeating groups so I could give you the specific XPATH relative to your file - however - I couldn't see any repeating groups when I viewed the file?!?!?!?!?!.

     

    Cheers,

     

    richie

     

  • Nastya_Khovrina 

    Hi Nastya,

     

    For my environment apparently it's a little bit different. I do receive a JSON response but your notation doesn't give me the proper assertion. I could use the 'point and click' action in ReadyAPI that gives me this:

     

     

    Thanks for your help though!

     

    Kind regards,

    AboveAndBeyond.

  • richie's avatar
    richie
    Community Hero

    Hey AAB

    ah - when I responded I hadn't seen Nastya_Khovrina's response.

     

    The json count assertion works only for a specific value - you can't specify any maths operators like >, < to say that a node has >10 records in there - this was the first thing I checked when I saw your post.

     

    HOWEVER - the XPATH which Nastya_Khovrina has provided IS what you need - right?

     

    I did try and view the .xml you attached to identify the repeating groups so I could give you the specific XPATH relative to your file - however - I couldn't see any repeating groups when I viewed the file?!?!?!?!?!.

     

    Cheers,

     

    richie

     

    • AAB's avatar
      AAB
      Regular Contributor

      richie 

      Hey Richie,

      Yes indeed, there are only companies present 1 time. It's enough to copy them several times in the file.  ;-) I didn't thought about that.

      thanks for your explanation!

      Concerning if it works or not: I still need to wait my environment access. I'll let you know  ;-)

       

      Cheers,

      AboveAndBeyond.

      • AAB's avatar
        AAB
        Regular Contributor

        Nastya_Khovrina 

        Hi Nastya,

         

        For my environment apparently it's a little bit different. I do receive a JSON response but your notation doesn't give me the proper assertion. I could use the 'point and click' action in ReadyAPI that gives me this:

         

         

        Thanks for your help though!

         

        Kind regards,

        AboveAndBeyond.