Forum Discussion

oksreenath's avatar
oksreenath
New Contributor
10 years ago

Looping thorugh a data source in SoapUI

I am using SoapUI pro and I have a test case with 70 test steps. I have an excel sheet with 70 rows which is used as the data source. My scenario is that, the values in each row should be assigned to each test step. Eg: test step 1 should retreive the value from row 1......test step 70 should retreive the value from row 70. The problem I am facing is that after I insert a data source loop to cycle through the data source, all the test steps take the final row values. I configured the data source loop with target step as first test step. Is there a work around for this problem?

  • nmrao's avatar
    nmrao
    Champion Level 3
    How different are the step 1 thru step 70, are they using same request or so? If yes, then you may not be needing 70 steps, instead use one step and use each row and loop thru end of the data in the source file.
    • oksreenath's avatar
      oksreenath
      New Contributor

      Hello,

      Thanks for the reply.

      I followed your answer, and reduced my teststeps from 70 to just 1.

      So now I have 1 test case and 70 inputs from the excel sheet.

      The problem I am facing now is how can I assert the response for each row in the excel file?

      Since when I execute the test case, it loops through all the rows and stops at the 70th row.

      How can I view the response for each row and then add an assertion??

      • nmrao's avatar
        nmrao
        Champion Level 3

        Glad to know.

         

        Not sure what you want to assert? So, would you clarify?

        1. Only certain element value of the response with the excel sheet row value?
        2. Have to compare the entire response for each row? How are you maintaining the data in that case?

         

  • Chiam_c's avatar
    Chiam_c
    Occasional Contributor

    you can try using something like a data sink before your datasource loop to print the response from the test step this would allow you to verify that the information your getting back is what you expect.

     

    also the log output should show if the request was succesful or not.  

    • kondasamy's avatar
      kondasamy
      Regular Contributor

      I faced this problem too! I finally ended up creating a groovy script to do the following!

      1) I would be feeding my data and assertions (usually contains, xpath match and script)

      2) Then using Groovy, I would fetch the data and run against the single teststep

      3) Based on the run, the result would be pooulated in the excel sheet with status and elaborated details for each test data

       

      So, I had a data driven framework which validates unique parameters for each test data.

       

      Thanks,

      Samy