Forum Discussion
I haven't changed this value. My File value is correct in ReadyAPI I believe, the project is in C:/dis-hl7 which is where the File says it is. But I will create a new project. Can you screen shot me your project setup and what your ${projectDir} resolved to when using a datasource & Test Suite setup script so I can see?
Hello jonathon
In my testing, ${projectDir} is always going to resolve to the parent of the directory the project is in. So it is resolving correctly when you are one directory deep from the root.
You do not need to specifically set Resource Root in your case because if it is not set, it defaults to ${projectDir}. Removing the content of that property might resolve some confusion.
In Suite Setup Script, you could use the path to your project which would contain the path that the project is in and hence where you are storing/retrieving your data... i.e. def projectPath = testSuite.getProject().getPath() + File.separator;
In your Data Source configuration to the location of your file, you can use nearly the same code as the Suite Setup Script but with a few more methods... i.e. ${=testRunner.getTestCase().getTestSuite().getProject().getPath() + File.separator}allergy-drugs.csv
If you set a property using that long method invoke string, you could shorten that a lot.
Anyway, these samples should give you the workaround to using the ${projectDir} value which is actually resolving correctly.
Regards,
Todd
- jonathon3 years agoContributor
Right, so it seems that projectDir resolves to the above folder. So at least for composite folders, anytime you want to use it in a datasource for a file you have to append in the actual project name. Which means you can never git clone into another named folder. I'm using testSuite.project.path in my suite setup, which does resolve to the $PWD
Related Content
- 11 years agojeffrey_crowley