Forum Discussion

ankitasanghani's avatar
ankitasanghani
New Contributor
8 years ago

Not able to obtain specific row values in the datasources step

I need to obtain specific row value in my request from the datasource step. As per the screenshot I'm trying to utilize first row using following in the JSON but not receiving the datasource values here-

 

{
  "drugName": "${TestData#drugname::0}",
  "nId": "${TestData#nId::0}",
  "showDel": "${TestData#showDel::0}",
  "stateCode": "${TestData#stateCode::0}"
}

5 Replies

  • avidCoder's avatar
    avidCoder
    Super Contributor

    You need to parameterize the key's this way:-

     

    {
      "drugName": "${TestData#drugname}",
      "nId": "${TestData#nId}",
      "showDel": "${TestData#showDel}",
      "stateCode": "${TestData#stateCode}"
    }

     

    Use DataSource Loop to loop through next row data.

  • Thanks for your reply!

     

    Yes so the loop works fine.

    My purpose here is to execute request separately with particular set (Row) of data.

    The reason for executing separately is to assert certain response tags. The different set of test data returns, different set of tag values. To assert this in the loop I would have to write a groovy script with conditional statement but instead I would like to assert using message content assertion. To do that, if I have ability to obtain specific row value from datasource, I can add the message content assertion to that particular request it self.


    ankitasanghaniwrote:

    I need to obtain specific row value in my request from the datasource step. As per the screenshot I'm trying to utilize first row using following in the JSON but not receiving the datasource values here-

     

    {
      "drugName": "${TestData#drugname::0}",
      "nId": "${TestData#nId::0}",
      "showDel": "${TestData#showDel::0}",
      "stateCode": "${TestData#stateCode::0}"
    }



    ankitasanghaniwrote:

    I need to obtain specific row value in my request from the datasource step. As per the screenshot I'm trying to utilize first row using following in the JSON but not receiving the datasource values here-

     

    {
      "drugName": "${TestData#drugname::0}",
      "nId": "${TestData#nId::0}",
      "showDel": "${TestData#showDel::0}",
      "stateCode": "${TestData#stateCode::0}"
    }


     

    • avidCoder's avatar
      avidCoder
      Super Contributor

      Did the solution work? Or you require more clarification?