18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

How to get the value of the testsuite parameter specified in ant task

hari19hari19 Members
edited July 2009 in Sahi - Open Source
My requirement is this :

1. I need to upload files using my web app
2. The files are stored in a directory relative to the directory containing testsuite file. <sahi testsuite="...." ... />
3. To construct the path to the files I need the location of the testsuite parameter.

_scriptPath() / _scriptFile() are not really useful in my case since the location of the scripts may change but not the files to be uploaded and hence do not want to depend on these functions.

How do I do this ?

thanks,
Hari
Tagged:

Comments

  • narayannarayan Administrators
    Good point. Currently files are picked relative to bin directory (which I am thinking, may not be the right thing to do). You may need to keep the file path in a variable or property file right now.
  • hari19hari19 Members
    Yes. I tried loading a properties file and it did not work because it pre-prended the present working directory ( <sahi-dir>/bin )

    Also, to read from a property file and not hard code any paths, I would need to construct the path to it which is again an issue.
    We need a function to return the location of the testsuite which we can expect to be a reasonable stable reference point.
  • narayannarayan Administrators
    Hari, don't you think, the script path should be the reference rather than suite? What if you were to run the script individually while fixing, debugging or editing the script? I think, using the suite as the reference point is not right.

    I think you should use _scriptPath as the reference and build the file path before upload. Views?
  • hari19hari19 Members
    The point is that the files are not specific to one script. For example, the properties file has parameters common to the test suite.
    Hence keeping it relative to one script is not really a solution for me.

    E.g.
    sahi-dir/my.test.suite
    sahi-dir/files/common.properties
    sahi-dir/files/myfile.xml
    sahi-dir/scripts/script1.sah
    sahi-dir/scripts/script2.sah
    
    My only constant in this test suite is my sahi-dir in which I would place my.test.suite.

    If the number of test cases becomes large I may choose to have sub-dirs for specific areas.
    sahi-dir/my.test.suite
    sahi-dir/files/common.properties
    sahi-dir/files/myfile.xml
    sahi-dir/scripts/security/script1.sah
    sahi-dir/scripts/functionality1/script2.sah
    sahi-dir/scripts/functionality2/script3.sah
    
    In this case I cannot be constructing the path to the properties file in each of my scripts.
    This is cumbersome/maintenance nightmare.

    Atleast this is how I would do it.
    Having a function return the location of the testsuite parameter would work for me.
    Some one else can make their own choice based on their needs.
  • narayannarayan Administrators
    OK, makes sense. You will have to wait a bit to get that functionality though.
Sign In or Register to comment.