Ask a Question

Composite Project and the Resource Directory

SOLVED
bmgriner
Frequent Contributor

Composite Project and the Resource Directory

I have seen documentation that talks about setting up a resource directory with defaults such as ${projectDir} or ${workspaceDir}. In a composite project, however, you will also have another folder right under the ${projectDir} level that will be the name of your composite project. I have my resource directory in there. I can obviously just specify ${projectDir}/[project_name], but I was curious... Is there is another dynamic key word that I could use instead?

A follow up question to that would be...what other values other than ${projectDir} and ${workspaceDir} are available by default in a SoapUI project?
6 REPLIES 6
SmartBear_Suppo
SmartBear Alumni (Retired)

Hi,

hmm.. I guess that is the way to go - there aren't any other predefined variables like this but you can use any property-expansion syntax in this field.

regards!

/Ole
SmartBear Software

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

I want to raise this same question again!

 

The ${projectDir} property gives me the path of the parent folder of my project folder, and not the project folder itself.

For a non-composite project this makes sense as you could put resource files on the same level as your project xml file.

 

For a composite project however, I want to use the relative project path, as it makes no sense to place my recource files outside the project folder.

I have all my recource files in a folder called <Data>, so I want to my project resource root to be ${projectDir}/[project_name] and refer to my file import paths as: <Data/filename.xml>.
Now I have to set them to: <[project_name]/Data/filename.xml>, which also means that all project member must use the exact same name for their project folder.
The last part is a problem with using Git, where you are allowed to rename your local project folder to anything.

 

What makes it even worse is when importing a new project from Git in ReadyAPI, the user is asked to place the project in an empty project folder. If the name of this user created project folder does not match the Git repository name (project name), then all project members might end up with different paths to data recources, and import conflicts.

 

Annotation 2019-06-20 153144.png

I would like a property with path to my composite project root folder, without creating a custom property for this.

 

The correct path is already in the value of the "Project property" called File, but I don't now how to refer to this property as it is not a custom property. Could this be done?

Annotation 2019-06-20 154440.png

 

 

I think the functionality of the "Recource root: ${projectDir}" should be changed once the project is set to a composite project! Otherwise I see no obvious use for this functionality.

Nastya_Khovrina
SmartBear Alumni (Retired)

Hi @matsorm,

 

Please see my comments below.


@matsorm wrote:

The correct path is already in the value of the "Project property" called File, but I don't now how to refer to this property as it is not a custom property. Could this be done?


You can use the following script to get the value:

 

import com.eviware.soapui.impl.wsdl.WsdlProject
def project = context.getTestCase().getTestSuite().getProject()
log.info(project.getPath())

 

Regarding changing the existing functionality:


@matsorm wrote:

I think the functionality of the "Recource root: ${projectDir}" should be changed once the project is set to a composite project!


If we change this option, this will broke existing users projects. But, maybe, we can create a new property for this.

 

You can create a new feature request here: 

https://community.smartbear.com/t5/ReadyAPI-Feature-Requests/idb-p/ReadyAPIFeatureRequests

 


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

Thanks for the script tip!
I added a line 

testRunner.testCase.setPropertyValue( "ProjectDirectory", project.getPath());

 and imported it with 

${#[SuiteX#TestCaseX]#ProjectDirectory}/myDataFolder/myFile

 

I would still like to see a custom property for this for composite projects, that could be used in the same manner as ${projectDir} for non composite projects, so that project members don't have to run a script before importing files.

Nastya_Khovrina
SmartBear Alumni (Retired)

Hi matsorm,

 

I'm glad to hear tha the provided solution helped you. 

 

If you still need the mentioned feature, please create a new idea here: 

https://community.smartbear.com/t5/ReadyAPI-Feature-Requests/idb-p/ReadyAPIFeatureRequests


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Olga_T
SmartBear Alumni (Retired)

Great to hear the solution was found! Thank you, @Nastya_Khovrina !

Let me mark this topic as solved.

Regards,

 


Olga Terentieva
SmartBear Assistant Community Manager

cancel
Showing results for 
Search instead for 
Did you mean: