Forum Discussion

richie's avatar
richie
Community Hero
12 months ago

Really Simple Question - DataSource File Issue

Hey,

 

So - been busy doing API testing strategy for the last 18months so really haven't done any testing - so I haven't been on here for quite a while - but I am back to testing, so I've just downloaded v3.48.0 and I've got a really daft issue that is blocking my work.

 

I have the following test:

 

DataSource (file type - it's a csv with 2 values that equate to URI parms in my REST Requests)

--GET REST Request1

--GET REST Request2

 

 

 

The URI to both my requests -->  /applications/{appId}/representations/publishable

 

My csv file contains 2 values - 998, 1334

 

 

For each REST request, I've got the {appId} URI parm set to source the value from the csv as follows:  ${Data Source#appId}

 

e.g. for the first REST request

 

 

and the second REST request

 

HOWEVER - when I run the test, both REST Requests source the SAME value (the first value '998' in the csv) to populate the {appId} URI parm

 

I've tried sticking the values on the same line in the csv e.g. --> 998, 1334 - but when I run the DataSource - it only returns the first value 998

 

 

I've tried sticking the values on separate lines in the csv (e.g.

 

998,

1334

 

and this time, when I run the Datasource, I get the following (2 rows) as I'd expect 

 

HOWEVER  - each time I execute the test case - the second REST Request fails because the value sourced from the DataSource is 998 - i.e. it never picks up the second value (1334)

 

When I was using ReadyAPI! before - I noticed some quirks - like if you change a parameter source, you'd have to click out of the field and then click Save to persist the changes - if you just changed the source and then clicked Save, the updated parameter source wouldn't be saved - but I've tried all that and it just doesn't work

 

I'm stumped!  This is really basic stuff and shouldn't even be a problem and so I shouldn't even need to ask - but I don't know how to resolve this - I've managed to get it to work a couple of times (i.e. the first REST request picks up the first value and the second REST request picks up the second value from the csv), but once I close ReadyAPI! down and relaunch, it goes back to the shonky behaviour I'm seeing - i.e. both REST Requests pick up the first value!

 

Has anyone got any tips that can help please?

 

 

UPDATE TO TICKET:  I've just noticed something else freaky.  If I execute the TEST CASE, it uses the first value in the CSV (998) for both REST test steps, meaning the 1st Request passes, the 2nd Request fails. 

HOWEVER - if I execute the individual TEST STEPS, the behaviour reverses - so 1st Request fails (cos the 2nd value in the CSV is being used) and the 2nd Request passes!!!!!

 

ANOTHER UPDATE TO TICKET: I just replicated the testcase, but instead of using a .csv, I tried the DataSource Grid option.  This time - the first value sourced from the Grid is actually the second value in there.  Rather than the first REST Step using the first Grid value, it's picking up the SECOND!  I'm pulling my hair out here!

 

Cheers!

 

richie

2 Replies

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 3

    Hi Ritchie

    Firstly, you're missing a Datasource Loop step.  You need the loop step after the API calls.

    You need the loop to flip back to the next row in your data source.

     

    After that, how is it do you want to test?

    - Same single call with changing app id for each iteration?  If so, disable the second step and your single column data source should be OK.

    - Two service calls per iteration?  If so, leave both service calls enabled.  Make the data source have two columns, e.g. val1 and val2.  Update service call 1 to reference val1.  Update service call 2 to reference val2.

     

    • richie's avatar
      richie
      Community Hero

      Hey ChrisAdams !!! 😁😁😁

       

      long time no chat - how you doing fella?

       

      After i saw your answer i realised what a dummy i was being - spend 18months/2 years reviewing java (RestAssured) automation frameworks instead and my ReadyAPI knowledge just disappeared!

       

      I remember how it works now - thanks man - you totally filled in the blanks - totally embarassed I was stuck on something so simple.   Ssssh!  don't tell anyone!😉

       

      Life Saver!

       

      rich