Forum Discussion

sukanya's avatar
sukanya
Contributor
7 years ago

Script Assertion

Hi,

We have two REST requests, Request1 and Request2

We need to write script assertion to check the amount value is 100.

We are writing assertion under Request1 and in the response1 we dont have amount value = 100. Now script i need is First I need to check the amount value in Response1 and write a if condition and call the request2 and get the response and match with my expected amount value.

 

Thanks 

 

  • Lucian's avatar
    Lucian
    Community Hero

    What is that amount you are talking about? Is it a parameter in the body of the response? Is it some value from some header? How does the requests and responses look like? You need to give us some more detailed info. 

    • sukanya's avatar
      sukanya
      Contributor

      It is a parameter in the body of response

       

      • Lucian's avatar
        Lucian
        Community Hero

        1. You have 2 requests and you want to add the balance found in those 2 requests?

        2. There are 2 elements called 'Amount' in your response. Which one is of interest to you?