Forum Discussion
Thanks for your responses.
It is working with the same usage as yours.
What is your software version?
However, there is a different value for File Project property when I compared with your image. For me it is including the directory name of the project as well. Have you modified it or is it the value coming for "File",
I believe that we should not edit the value of File, it should come automatic.
Would you please create a new composite project and check if the value for File project property is coming automatic? Also the ${projectDir} value evaluated automatically and it is expected value?
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?
- TNeuschwanger3 years agoChampion Level 2
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