Forum Discussion

maxrussell's avatar
maxrussell
Contributor
4 years ago

Excel data sources - using a relative path name for files

We need to use ReadyAPI across different machines. Our code is checked out from Git and sometimes our local directories differ (for example I use E:\, a colleague uses C:\)

 

As we need to share our data sources (excel files) that are also checked in, how can they be set in ReadyAPI to use a relative Path, instead of fixed paths?

  • PrathapR's avatar
    PrathapR
    Frequent Contributor

    Hi maxrussell 

    Can you please use relative paths.

    Instead of using  "E:/GitRepo/Test/Sample.xlsx" use ${projectDir}/GitRepo/Test/Sample.xlsx. Always keep these excel file folders(Ex:GitRepo/Test..along with project file(.xml)  wherever you store, either in version control or local.  And Change like below at project level properties.

     

     

    https://support.smartbear.com/readyapi/docs/testing/best-practices/root.html

     

    Thanks!

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thanks everyone!

       

      maxrussell Does the suggestion help? Please let us know.

  • When I try to use the $projectDir variable, I get errors on my datasource test steps:

    • richie's avatar
      richie
      Community Hero
      Hey @maxrussel,

      Can you indicate step by step exactly what you did please?
      Looking at the screenshot it appears that two full paths have concatenated so it reads something like E:/...E:/fullpath

      Ta

      Rich