Forum Discussion

srandall's avatar
srandall
Contributor
7 years ago

Obtain Property Values of the Specific Row

I am using a DataSource connecting to a Database. We have a call that pulls back the history on specific records. Because there are many to one records that get pulled back in our API, I am needing to be able to identify in my Assertion which record I want Ready API to look at.

 

I found an article that appears to be what I am needing, however I'm having a difficult time understanding where to apply this. Everywhere I try to implement it, it fails.

 

https://support.smartbear.com/readyapi/docs/soapui/steps/data-source.html?q=datasource+%3A0%3A1%29&_ga=2.17986105.1859947542.1504100420-1440569110.1494869902

 

I am using the response from my test case to apply my assertions (using Content as my assertion). Since the API pulled back multiple records for the call, I need to be able to have the first record applied to my assertion; however, it fails because Ready API isn't looking at the first record. I thought I would be able to apply (${DataSource_CaseHistory#bknCaseHistoryID:00} as my content and it would look at the first row; however it does not.

 

Can anyone tell me how and where I can identifying the row I want my assertion to be looking at?

 

8 Replies

  • sanj's avatar
    sanj
    Super Contributor

    it its multiple records then it should be in an aray

    how about (${DataSource_CaseHistory#bknCaseHistoryID[0]}

    How can you find out

    Use outline view for your response and do assertion from content

    Hope that helps

  • nmrao's avatar
    nmrao
    Champion Level 3
    Would you mind showing your data?

    The documentation reference you provided not have the row index. Not sure where you get that screen shot which shows the index thing.

    Any ways, have you tried

    ${DataSource_CaseHistory#bknCaseHistoryID::0} ? Assuming that "bknCaseHistoryID" is the column name.
    • srandall's avatar
      srandall
      Contributor

      I created my datasource for the test case for pulling back CaseHistory:

       

      In my DataSource, I am pulling back the data I need:

       

      I'm pointing to my DataSource to use the data my source has provided  to apply my assertion:

       

       

      I navigate to my DataSource Property:

       

       

      I have tried point to the row by adding ':00' and I receive this message:

       

       

      I also tried adding '[0]' as sanj suggested, but have not been able to get a successful result as of yet.

       

      Any suggestions would be greatly appreciated. :-)

      • sanj's avatar
        sanj
        Super Contributor

        Do the following to access the current row

         ${DataSource_CaseHistory#bknCaseHistoryID}

         

        I am giving a screenshot of how i do datasource tests

        It also includes the dataloop setting your start and end row to whatever you want to test

        Hit run on datasource so it reflects data you trying to test and then run the whole test which would be 

        datasource

        your test step that does the compare and the dataloop

        I hope this answers your question and concerns

         

        You like the reply. How to give a Kudos / Accept as solution?