Forum Discussion

ibright's avatar
ibright
New Contributor
2 years ago

Using a file location stored as a project property in a groovy set up script

I have created a test case that outputs the failed results to a file. I only want the file to be present in the folder if there are failed results to be viewed so I created a set up script that deletes the file at the start of each test run.

What I want to do is use the folder path set in the project property to avoid it being hardcoded in each test case in the project.

I used Get Data to get the project property and it automatically created this:

def aPIresultsfolder = context.expand( '${#Project#API results folder}' )

 

How do I get it to work with this part of the script that I had already set up:

new File(folderPath).eachFile (FileType.FILES) { file ->
//Delete file if file name contains Forward NDF errors
if (file.name.contains('Forward NDF errors')) file.delete()
}

This is the