Forum Discussion

Computer_Resear's avatar
Computer_Resear
Occasional Contributor
16 years ago

Datasink teststep cannot handle multiple files

We have the following scenario,

1.  Groovy test step to read files in a dir and hold the list in context.  The script also sets up a property step (FilesToBeReadProperty) with one property called currentFile.

2.  Datasource teststep uses ${FilesToBeReadProperty#currentFile} to read in the excel datasource.

3.  Some web service call.

4.  Property Transfer step to a data sink.

5.  The Data Sink has to write to the same file as the data source so I used the same property expansion ${FilesToBeReadProperty#currentFile}.

6.  Finally a groovy step to check if all files have been processed, if not go back to step 1 and get the next file from context and perform all the steps.

I have a setup script that sets up the first file.  If I don't do this, soapUI initial validation of teststeps will fail for the Data Sink saying that file was not found.  I assumed that in each iteration, the data source and data sink will use the new file name from ${FilesToBeReadProperty#currentFile}.  Altough the data source does, the data sink writes only to the file it was validated with before saopUI runs the testcase.  In other words, if I have five files, all of them are processed and the results is written to one file.
Please let me know if you have any work around for this so results of a processed file is written to the same file.

Thanks.

3 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    correct, the Excel DataSink does currently support different file names for different iterations, I'll have a look at this to see if it can be fixed easily.

    regards,

    /Ole
    eviware.com
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi!

    please try working around this for now by adding a script before you start the next file which "restarts" the DataSink;

    def ds = testRunner.testCase.testSteps["DataSink"]
    ds.finish( testRunner, context )
    ds.prepare( testRunner, context )

    The call to finish will write and close the target excel file. The call to prepare will open it again using the new property values, so this has to be called when new property values are available.

    Does that help?

    regards!

    /Ole
    eviware.com