I am updating a groovy script which build a test runner suite inside SoapUI. The scripts scan a folders and add test case for each file in each folders.
The problem I am trying to solve is that the script is using eachFileMatch() which does not have a consistent behavior between Windows and Unix file systems. I need to update the script so that files are listed alphabetically.
I am quite new to groovy so I don't know where to get started. Saw that a sort() method does exist but I am not sure I can use it on eachFileMatch.
Here's the code snippet I need to adapt :
new File(projectPathTest+"/nord").eachDir{dir->
log.info("Dir > "+dir);
operation = dir.name
def wsdlTestCase = testSuite.addNewTestCase( operation )
wsdlTestCase.setFailOnError(false)
dir.eachFileMatch(~/.*_request\.xml/){file->
// Need Alphabetically sorting here
log.info("File >> "+file)
addTestStep(operation, file, wsdlTestCase, projectPath, endPoint)
}
Any starting point to do it will the groovy approach would be really appreciated as for now i don't have time to delve into the groovy API.
Regards }