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.

Is data driven possible through Sahi?

fanindrafanindra Members
edited November -1 in Sahi - Open Source
Is data driven possible through Sahi?

Comments

  • Hi Fanindra

    we can perform data driven test through Sahi. Please go through the Forms (http://sourceforge.net/search/?group_id=151639&words=data+driven&type_of_search=forums&pmode=0&limit=25),there you will get help.
    Till now i did not perform data driven test in my application. please gather information,hope this will usefull for feature use.
  • narayannarayan Administrators
    Yes, it is possible.

    Have a look at _getDB and related functions.

    While adding your database driver to the class path, you should modify sahi.bat so that it looks like this:

    java -cp ../extlib/your_driver.jar;../lib/sahi.jar net.sf.sahi.Proxy

    in place of

    java -jar ../lib/sahi.jar

    For sahi.sh use

    java -cp ../extlib/your_driver.jar:../lib/sahi.jar net.sf.sahi.Proxy
  • BhaktiBhakti Members
    edited April 2008
    Hi,

    I made required changes to the sahi.bat and wrote the following code.

    var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver","jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:sahi/Data/User.xls","","");
    var $rs ="";

    _set($rs, db.select(select * from Sheet1));

    _setValue(_textbox("userName"), $rs);
    _setValue(_password("password"), "build1");
    _click(_imageSubmitButton("Login"));
    _click(_imageSubmitButton("Continue"));
    _click(_link("Logout"));
    _click(_image("OK"));


    And I still get the error :
    handleSet('\$rs' + 1, db.select(select * from Sheet1;));
    --Stopped Playback: FAILURE--

    I am not sure what went wrong.
    Will some one plz help?
  • narayannarayan Administrators
    use _set($rs, db.select("select * from Sheet1"));
    The quotes are missing on that line.
  • raja1raja1 Members
    i am also getting a similar error. I am using the latest Sahi release. See the error below

    handleSet('\$rs' 6, db.select("select * from Sheet1"));

    Here is my modified sahi.bat:

    SET EXT_CLASS_PATH=C:\sahi\lib\Excel_JDBC30.jar
    #SET EXT_CLASS_PATH=%EXT_CLASS_PATH%;..\extlib\mysql-connector-java-5.0.4-bin.jar
    SET SAHI_CLASS_PATH=..\lib\sahi.jar
    SET MOZ_NO_REMOTE=1
    java -classpath %EXT_CLASS_PATH%;%SAHI_CLASS_PATH% net.sf.sahi.Proxy

    i have copied the Excel_JDBC30.jar in the lib folder.

    Here is my code:

    createGroup("admin", "ChangeMe");

    function createGroup($username, $password){
    _setValue(_textbox("log"), $username);
    _setValue(_password("pwd"), $password);
    _click(_submit("Login \u00bb"));
    _click(_link("Users and Groups"));
    _click(_link("Groups"));

    var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver","jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:sahi/scripts/Tests/cv4/data/groups.xls","","");
    var $rs ="";
    _set($rs, db.select("select * from Sheet1"));

    _setValue(_textbox("newName"), $rs[0]["groupname"]);
    _click(_submit("Add Group"));
    _setValue(_textbox("description"), $rs[0]["groupdescription"]);
    _click(_image(41));
    _click(_submit("Save"));
    _click(_link("Logout"));
    }

    I have taken all the required steps discussed in the forum. Can anyone point out what am i doing wrong
Sign In or Register to comment.