Forum Discussion

skillsoft's avatar
skillsoft
Frequent Contributor
16 years ago

Excel, property files relative to testsuite in Datasource step

I want to be able to use the same spreadsheet for all testcases in a test suite using a relative path.  I'm doing this by creating a property for the test suite that specifies the \.  I have the Resource Root set to $(projectDir). I have Composite Project set to true.

It seems like the only way to do this is to create a property at the project level and hardcode the project directory, then use that property at the suite level

Example:  suitedir  = ${#Project#projectdir}\CreateOrEditCompany

Is there a way to use the Resource Root or even $(projectDir) directly in the Suite property?

Ideally it would be better to be able to NOT specify a path when creating a Datasource step and having the path default to the Suite Directory, but currently it seems to be defaulting to the C:\>. 

Thanks for your time!!

Mary
  • Hi Mary,

    if you have a Resource Root set, the path you specify should be resolved relative to that value. Alternatively you can use ${projectDir} directly in the excel path.. Are you using the latest version or an older one?

    regards!

    /Ole
    eviware.com
  • skillsoft's avatar
    skillsoft
    Frequent Contributor
    Hi Ole,

    I am using 3.0.1. We just purchased the pro version last week.  I downloaded this off your website a little over a week ago (went from trial to registered version).  If I use ${projectDir} in the File Field of the Datasource path (Excel is my datasource) it ignores it and thinks I'm looking on C:\> for the file.

    Example:

    ${projectDir}\serverinfo.xls (have also tried without the slash, forward slash, double back slashes)

    I will get:

    java.io.FileNotFoundException: C:\serverinfo.xls (The system cannot find the path specified)

    If I enter just "serverinfo.xls" into the File: field I get a similar error.  It doesn't seem to be recognizing ${projectDir} at all when I use it in a property or filename field.  Is there something else I can check or is it possible this doesn't work?  I have never had a previous version of SoapUI on the VM I'm working from.

    Thanks!

    Mary
  • skillsoft's avatar
    skillsoft
    Frequent Contributor
    The actual directory of the project is C:\hapitests.  The directory of the suite would be C:\hapitests\CreateOrEditCompany. 
  • Hi!

    then the path C:\serverinfo.xls is actually correct, since the directory containing your project is c:\

    so you could enter "hapitests\CreateOrEditCompany\serverinfo.xls" ?

    regards!

    /Ole
    eviware.com
  • skillsoft's avatar
    skillsoft
    Frequent Contributor
    That answer didn't make any sense.  The directory containing my project is c:\hapitests not c:.


    Please explain...
  • Hi Stacy,

    "hapitests" is the root folder of your project, had you saved it as a non-composite it would have been a file named "hapitests.xml" instead.  Either way, the folder containing this folder or file is the projectDir.

    I agree you have a point but this is how soapUI sees it, sorry..

    regards!

    /Ole
    eviware.com