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.

Sahi Proxy and DB calls...

Cubicle.JockeyCubicle.Jockey Members
edited August 2008 in Sahi - Open Source
Can anyone tell me a way to control Sahi....yes control it. I have two lines in one of my scripts that call a database query yet when the proxy is start and the page is set through the controller it calls the db queries. This is strange to me it hasn't hit the line of code that calls this method so why is the proxy calling it. Plus besides that when it does get to the line that calls the database query it does it 5 or 6 times.

Here is some output on what the SahiProxy is doing: (user name and password removed for obvious reason)

At the very end of this output you will see it search for BVTUser again and that user is not longer in the database as it has been modified to EditedBVTUser!

SQL: SELECT SUBSCRIBER_SET_NAME, SUBSCRIBER_SET_DESCRIPTION FROM SUBSCRIBER_SETS
WHERE DELETION_USER IS NULL and SUBSCRIBER_SET_NAME = 'BVTUser'
### Creating New Socket : 13444
### Creating New Socket : 13445
### Creating New Socket : 13446
### Creating New Socket : 13447
### Creating New Socket : 13448
### Creating New Socket : 13449
### Creating New Socket : 13450
### Creating New Socket : 13451
### Creating New Socket : 13452
### Creating New Socket : 13453
Driver: oracle.jdbc.driver.OracleDriver
JDBC URL: jdbc:oracle:thin:@10.^^^.^^^.18:&&&&:orcl
Username: *******
Password: ********
SQL: SELECT SUBSCRIBER_SET_NAME, SUBSCRIBER_SET_DESCRIPTION FROM SUBSCRIBER_SETS
WHERE DELETION_USER IS NULL and SUBSCRIBER_SET_NAME = 'BVTUser'
Driver: oracle.jdbc.driver.OracleDriver
JDBC URL: jdbc:oracle:thin:@10.^^^.^^^.18:&&&&:orcl
Username: *******
Password: *******
SQL: SELECT SUBSCRIBER_SET_NAME, SUBSCRIBER_SET_DESCRIPTION FROM SUBSCRIBER_SETS
WHERE DELETION_USER IS NULL and SUBSCRIBER_SET_NAME = 'BVTUser'
Driver: oracle.jdbc.driver.OracleDriver
JDBC URL: jdbc:oracle:thin:@10.^^^.^^^.18:&&&&:orcl
Username: *******
Password: *******
SQL: SELECT SUBSCRIBER_SET_NAME, SUBSCRIBER_SET_DESCRIPTION FROM SUBSCRIBER_SETS
WHERE DELETION_USER IS NULL and SUBSCRIBER_SET_NAME = 'BVTUser'
Driver: oracle.jdbc.driver.OracleDriver
JDBC URL: jdbc:oracle:thin:@10.^^^.^^^.18:&&&&:orcl
Username: *******
Password: *******
SQL: SELECT SUBSCRIBER_SET_NAME, SUBSCRIBER_SET_DESCRIPTION FROM SUBSCRIBER_SETS
WHERE DELETION_USER IS NULL and SUBSCRIBER_SET_NAME = 'BVTUser'
### Creating New Socket : 13454
Driver: oracle.jdbc.driver.OracleDriver
JDBC URL: jdbc:oracle:thin:@10.^^^.^^^.18:&&&&:orcl
Username: *******
Password: *******
SQL: SELECT SUBSCRIBER_SET_NAME, SUBSCRIBER_SET_DESCRIPTION FROM SUBSCRIBER_SETS
WHERE DELETION_USER IS NULL and SUBSCRIBER_SET_NAME = 'BVTUser'
Driver: oracle.jdbc.driver.OracleDriver
JDBC URL: jdbc:oracle:thin:@10.^^^.^^^.18:&&&&:orcl
Username: *******
Password: *******
SQL: SELECT SUBSCRIBER_SET_NAME, SUBSCRIBER_SET_DESCRIPTION FROM SUBSCRIBER_SETS
WHERE DELETION_USER IS NULL and SUBSCRIBER_SET_NAME = 'EditedBVTUser'
Driver: oracle.jdbc.driver.OracleDriver
JDBC URL: jdbc:oracle:thin:@10.^^^.^^^.18:&&&&:orcl
Username: *******
Password: *******
SQL: SELECT SUBSCRIBER_SET_NAME, SUBSCRIBER_SET_DESCRIPTION FROM SUBSCRIBER_SETS
WHERE DELETION_USER IS NULL and SUBSCRIBER_SET_NAME = 'BVTUser'
### Creating New Socket : 13455
### Creating New Socket : 13456
### Creating New Socket : 13457
### Creating New Socket : 13458
### Creating New Socket : 13459
### Creating New Socket : 13460

Comments

  • Cool... somone in my neighborhood.

    So are you saying that your DB routine is in a function?
  • Cubicle.JockeyCubicle.Jockey Members
    edited August 2008
    function snapinDBGetSubscriberSets($subscriberSetName)
    {

    var db = _getDB($DBDriver,$DBConnect,$oracleUserValue, $oraclePasswordValue);

    var $subscriberSetDB = [];
    $subscriberSetDB = db.select("SELECT SUBSCRIBER_SET_NAME, SUBSCRIBER_SET_DESCRIPTION FROM SUBSCRIBER_SETS WHERE DELETION_USER IS NULL and SUBSCRIBER_SET_NAME =
    '"+$subscriberSetName+"'");

    return $subscriberSetDB;

    }

    i was thinking about wrapping the _call() method around it but I am not sure if that will swallow my return values!


    Added _call() around my function calls and it didn't change the out come of the proxy redoing the original query when it shouldn't!
  • Are you sure you want to create a new database connection every time you call this function? Something tells me the database connection should be created outside the function and the db object passed in.

    I've found that functions are evaluated and called if they are defined but never called later in the script e.g.

    function something () {
    *do something*;
    };

    *do something* happens when the script is loaded because something(); is never called.
  • Cool I will try fiddling with that...this method was made by someone else I will see what I can do knowing that now.

    Thanks I will post back if it fixes the issue or if it doesn't!
  • rksrks Members
    I also faced same issue but for me wrapping the method call in _call() did the job for me.
  • Yeah I tried wrapping the method(OOP people)/function for sahi ;) in a _call didn't quite make it behave! I am going to do what I shouldn't have to do I am going to break my test into two seperate test and have it run the first query on the first set of steps. Then for the second set of steps run it as a different test with the new query. Sahi is very broken is some aspects and its frustrating others its great who knows maybe it will be fixed someday! There is another tool we use here in conjunction with Sahi and its called AutoIt for those who care for an alternative or a complement, it also allows you to get into windows forms.

    Before people get up in arms about me posting about another tool here I am just doing it as a complimentary tool I don't use one over the other just were one falls short I use the other and go back and forth!
  • I post about AutoIT on these forums all time.

    AutoIT and Sahi complement each other well and make for great hybrid systems.
Sign In or Register to comment.