Forum Discussion

stefankranz's avatar
stefankranz
Occasional Contributor
5 years ago

Datasource Loop with Script

Hi, i am new in this field. But i have made some test with Ready API and these works fine.

I have a simple question:

I have in my Test 4 Parts.

1. Datasource

2. Datasource Loop

3. A Soap Request with Data

4. a Groovy Script to writes the Response Files

How i can put in the Loop my Groovy Script ? These Loops run only with the DatasourceLoopReport and the GetDocument.

 

Thanks,

Stefan

 

3 Replies

  • richie's avatar
    richie
    Community Hero
    Hey stefankranz,

    The DatasourceLoop step is typically the last step in the sequence.... i may be misunderstanding the purpose of your test but if you alter the sequence of steps as follows, wouldnt this solve thr problem?

    Datasource
    GET (SOAP) base64.encoded
    Groovy (base64.decode)
    DatasourceLoop


    Wouldnt the above satisfy and include the decode in the loop or am i missing something?

    Cheers,

    Rich
  • nmrao's avatar
    nmrao
    Champion Level 3
    There are couple of options, have response writing logic in one of the below:
    - Use events feature AfterStep, but save conditionally (i.e.,only if the step name is specific so that it won't write for unwanted steps).
    - the script assertion (i understand it is a bit wierd, but it can do the job)

    And you wont need the additional groovy script test step.
    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thank you so much nmrao and richie!

       

      stefankranz , did you have a chance to try out the approaches the Community suggests? Please share your progress with us.