Ask a Question

How to parameterize or set the relative path for the location of data source as used for data-driven

SOLVED
shiv
New Contributor

How to parameterize or set the relative path for the location of data source as used for data-driven

Hi Community Experts,

 

I've a question on parameterization or set the relative path for the location of data source as being used for data-driven using excel in the Ready API 1.6.0.

 

Exp: Data Source Path: C:\Working Folder\Automation\Data\source.xls

 

Here how to make the relative path, so that if we shift the code to other machine, it should work without changing the data source location manually. Any other related workaround will also work.

 

Appreciate in advance for quick response

 

Thanks,

Shiv

2 REPLIES 2
Chowdhary
Contributor

The best answer for ur question was, create the data source as data generator, then this works where ever you want. not manually exporting the data from excel [If it works]

Vam
nmrao
Community Hero

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)



Regards,
Rao.
cancel
Showing results for 
Search instead for 
Did you mean: