Forum Discussion

saiprasad531's avatar
9 years ago

how to add multiple values in Contains Assertion

how the values should be seperated. request 1 will depend on request to if the response has all 8 values. Do I need to add assertion for each single value ?

8 Replies

  • nmrao's avatar
    Champion Level 3
    Unclear. Can the question be more specific possible with any example or screen shot etc?
    • JamesChorus's avatar
      New Contributor

      Hi Rao,


      I am also trying to do what the original user was asking. This is where you have your request set up, You are on the Assertions tab, and you wish to add in multiple/a list of assertions in One "Contains Assertion" check.


      So, how do you separate each value you wish to check for?  OR are you only able to add one Contains Assertion value per Assertion?


      Thanks, James

      • nmrao's avatar
        Champion Level 3
        Not sure I got it quite right. It is general practise that, there should be a separate assertion for each value. This is really helpful to know in case of failures.
  • Having individual assertions is the standard approach. But if you still wish to do that, you can't do that on Contains assertion. But you can use XPath assertion and have Contains function

    Your declaration would be: 

    contains(//*:ResponseFiled, "ValueToValidate1") and contains(//*:ResponseField, "ValueToValidate2")

    Expected would be: true


    Hope that helps