How to parameterize or set the relative path for the location of data source as used for data-driven
- 9 years ago
You can use property expansion.
For example:
The project and its artifacts on your machine located at C:\Working Folder\Automation\Data\source.xls.
That means, you have taken the project artifacts (Automation directory) from the repository to C:\Working Folder
However, it can be different location on a different computer or collegue's machine, say D:\workspace. But the rest of the location is same which is why you wanted to refer to relative location.
So, you can define a project level custom property, say PROJECT_ARTIFACTS_LOCATION and define value as C:/Working Folder. Others can change the property value on their environment. Now, this works on any machine with just property value change.
In the DataSource step, have the value for File as ${#Project#PROJECT_ARTIFACTS_LOCATION}/Automation/Data/source.xls.
Note that you can't use browse button for this, just type in as above.
Of course, it is not mandatory that you need to use Project level property alone. You are free to choose different level properties such as TestSuite, TestCase or even projectDir (same location as soapui prject is located, for example, just use ${projectDir}/file.xls)