cancel
Showing results for 
Search instead for 
Did you mean: 

Make File Lookups Relative for Composite Projects

mrugglesaz
Occasional Contributor

Make File Lookups Relative for Composite Projects

For regular projects in SoapUI Pro, you can set the Resource Root at the project level to be either ${projectDir} or ${workspaceDir} so that file lookups will be relative to the directory where the project or workspace file is stored. Given how this works in a regular project, I assume that files are being located relative to where the project XML file is stored, meaning that my files will be found if they are in the same directory as my [project name].xml file.

 

However, for composite projects, this isn't possible since the project is broken up into several small XML files representing the separate test cases within the project.

 

Would it be possible to add an option in Resource Root for the parent directory of a composite project so that all file lookups are relative to the parent? 

6 REPLIES 6
nmrao
Community Hero

Re: Make File Lookups Relative for Composite Projects

Would you please provide the use case?

How you wanted to place the resource files and and in which steps those needs to be accessed?



Regards,
Rao.
mrugglesaz
Occasional Contributor

Re: Make File Lookups Relative for Composite Projects

The use case is any ReadyAPI composite project that is checked into a repository so that multiple team members can work on it together. Primarily the resource files in question are those used by Data Source steps like spreadsheets, XML files, etc. Entering the File path to a spreadsheet that feeds a Data Source step cannot be made relative to the project directory after making the project a composite since the directory structure is dramatically changed after doing so.

 

In a regular project, setting the Resource Root setting to ${projectDir} makes the file lookup relative to the directory where the project XML file is stored. If you store a spreadsheet in the same directory as the project XML file, then simply entering the name of the file in the File path field in the Data Source step will locate it. However, in a composite project, the XML file is divided into smaller units so that there is no longer one main location so a lookup relative to the project file's location isn't possible. 

 

Since a composite project seems to be based upon building a folder structure that mirrors the project structure inside of ReadyAPI, can an option be added to make lookups be relative to the parent directory of the project? This would be equivalent to the project level in ReadyAPI. The attached screenshot shows this concept.

nmrao
Community Hero

Re: Make File Lookups Relative for Composite Projects

I believe, you can still use ${projectDir} in the composite project as well.

If you want to place the resources inside the Test Suite or Test Case directory, then append the same after ${projectDir}

Say a data.csv is placed under projectX (Project), suiteY (Test Suite), and kaseZ (Test Case) , then refer it as
${projectDir}/projectx/suiteY/kaseZ/data.csv

Haven't tried for myself, but worth giving it a try.


Regards,
Rao.
mrugglesaz
Occasional Contributor

Re: Make File Lookups Relative for Composite Projects

This works, but only because you are supplying so much of the directory path in the File path field. That kind of defeats the purpose of the original functionality of designating the Resource Root property. When you use ${projectDir} as the Resource Root, at least for regular projects, all you need to enter in the File path field is the name of the file you are looking for, no extra path information is needed. That is most helpful when sharing a project with someone else since ReadyAPI will look in the directory where the project file is stored. All another person needs to do to get tests running correctly on their machine is to have the data source file in the same directory as the project file; ReadyAPI takes care of finding the file in the background. However, it is not so with composite projects, which is a shame because composites are meant to be shared with other people to work on them collectively. Yet, relative lookups don't work correctly.

 

It would be great if this could be fixed. In the meantime, we have found a workaround that is finally working for us. The local and remote folders have to be named exactly the same. Git renamed the remote to have dashes where there were spaces in the local directory name. In other words, CSBook SWS Build PNR Project (local) was renamed by Git to be CSBook-SWS-Build-PNR-Project (remote). Once I renamed my local to match Git, then we were able to enter something resembling a relative lookup using the following File path value:

 

CSBook-SWS-Build-PNR-Project/Datasource.xlsx

 

It's not exactly the same as the Resource Root functionality, but it's working. If the Resource Root functionality could be fixed for composite projects as a low priority, that would be a better solution. Thanks.

nmrao
Community Hero

Re: Make File Lookups Relative for Composite Projects

Good you found the workaround.
Still didn't understand what your approach is ?

You may raise a feature request for the same for your use case.
https://community.smartbear.com/t5/ReadyAPI-Feature-Requests/idb-p/ReadyAPIFeatureRequests


Regards,
Rao.
mrugglesaz
Occasional Contributor

Re: Make File Lookups Relative for Composite Projects

Rao:

 

I don't understand how this feature request process works. You gave me a link to raise a feature request that takes me back to the same page where I started this thread. I thought that's what I was doing with this request. If you could please submit this request "as is" I'm sure someone who is more familiar with the relative lookup functionality will probably understand the scenario I'm proposing. I would also be happy to take a phone call with one of the engineers to demonstrate what I'm talking about.

 

Thanks,

 

Mark Ruggles

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors