Forum Discussion

mrugglesaz's avatar
mrugglesaz
Occasional Contributor
3 years ago

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

  • nmrao's avatar
    nmrao
    Champion Level 3

    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?

    • mrugglesaz's avatar
      mrugglesaz
      Occasional Contributor

      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's avatar
        nmrao
        Champion Level 3
        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.