Forum Discussion
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() }
Implement "TestRunListener.afterStep" method and have your code in there.
- BernardV5 years agoOccasional Contributor
nmrao do you know of the way to identify the current file 'in-use' by the test case? As if I place my current script in there it will delete everything when it triggers; I need to reference the correct file name in TestRunListener.afterStep.
- nmrao5 years agoChampion Level 3I do not have the context "current file" or your test data structure or the way you reading files. What files are you reading actually and trying to remove it?
- BernardV5 years agoOccasional Contributor
Hi nmrao so I'm iterating through a folder that contains .XML files.
Example:
50 .xml files in folder: "C:/test/XML Files"
My SoapUI test currently iterates nicely through each file and submits them to a Soap Webservice:
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.
Ideally I would like my script to simply delete or move a file that was just submitted in the data source loop.
Thanks!