Forum Discussion

BernardV's avatar
BernardV
Occasional Contributor
6 years ago

Deleting or moving a file after successful submission (SOAP Project)

Good day, 

 

I'm currently working on a simple test case that currently consists of the following steps:

 

1. Data Source: Folder (containing .xml files)

2. SOAP Request 

3. Data Source Loop (to iterate through and send each file found in the data source folder)

4. Assertions.

 

I would like to have a step that deletes OR moves the relative .xml request file from the data source folder after a response is received for it, would this be at all possible?

 

Thanks!

    • BernardV's avatar
      BernardV
      Occasional Contributor

      Thanks nmrao but I'm not having much luck with my specific scenario and finding what I need, Groovy examples seem very sparce and documentation extremly poor, and I'm having to figure this out myself. I you happen to have an example that would be much appreciated.

      • BernardV's avatar
        BernardV
        Occasional Contributor

        Okay I have figured out a solution that will delete all files after test execution (ideally I would like them to be deleted as they receive a response but I have not found antything that would allow this) also I would love if this was a test step in the GUI of Soap UI, like 'Delete File(s)':

         

        File xmlFolder = new File("C:/test/XML Files")
        
        xmlFolder.eachFileMatch(~/.*.xml/) {
            file - >
                log.info("${file.name} will now be deleted")
            file.delete()
        }

        nmrao