Forum Discussion

arhansen's avatar
arhansen
New Contributor
15 years ago

Access to DataSink file name from Groovy script

Using SOAP ui pro 3.0.1 -
How can I Get or Set the file pathname on a DataSink step from a Groovy step?

I would like the DataSink file to have a name related to my dataSorce pathname, which I query the user for & set from within a test case setup script.

Also, in my test case teardown script I try to rename my DataSink pathname (manually hard coded to match the current canned pathname). My file.renameTo(new pathname) succeeds when executing the teardown script individually but fails when the whole test case is executed.

Thanks

arhansen

1 Reply

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

    Please try setting set the filename with

    testRunner.testCase.testSteps["DataSink"].dataSink.fileName = ...

    Regarding the failure to rename the file, this is probably because the DataSink is still holding on to it? What error are you getting? Maybe you can put the rename in a runnable that is scheduled with SwingUtilities.invokeLater ?

    regards!

    /Ole
    eviware.com