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.

Script execution and Database Cleaning

WindBladeWindBlade Members
edited November -1 in Sahi - Open Source
Hi
What is the best way to run a number of scripts sequentially? Suite seems to run concurrently.

And What is the best way to clean up the database after each test so that every run of the test runs consistently and with an initial set of data?

Thanks

Comments

  • Hi WindBlade,

    You can expect this feature in the future releases.

    And to clean up the database you can use the below script for firing any query in database:

    var $driverName = "Driver(eg: com.mysql.jdbc.Driver)";
    var $jdbcurl = "JDBC URL (eg: jdbc:mysql://<hostname>:<port>/<DB-Name>)";
    var $username = "username";
    var $password = "password";

    var $connection = null;
    try {
    java.lang.Class.forName($driverName);
    $connection = java.sql.DriverManager.getConnection($jdbcurl, $username, $password);
    var $st = $connection.createStatement();
    var $sql = "Delete from TableName"
    $st.executeQuery($sql);
    } catch ($e) {
    $e.printStackTrace();
    } finally {
    if ($connection != null){
    try{
    $connection.close();
    }catch($e2){
    $e2.printStackTrace();
    }
    }
    }


    Regards
    Sumitra
Sign In or Register to comment.