Open Source Tools – Using Sahi for Automation

Open Source Tools – Using Sahi for Automation

Abstract – Using Sahi for Automation

We engineers suffer from paranoia of fear of the unknown, so either try to start via some acclaimed test automation tool or want to build tool from a scratch trying to either save us from troubles and in the later case maybe marking our capacity or potential without actually realizing what would help the organization when it comes to web related test automation. I confess myself to be the first one on the list.

During one of the days, we were trying to do a yahoo messenger related test automation using QTP. So we had to actually burn nights to make it work because of the complexities of the tool. Once I did the entire stuff in perl and thought that the customer would be more than happy,. unfortunately it turned out to be the other way round. In Software engineering we often say, “Client is always right” alternatively in product companies, “Boss is always right”.

I was told to explore Sahi for our product test automation, where we have 100% Systems tests automated using one of the Mercury products. And its been a while since I had seen sahi, and was quite apprehensive about the tool. It turned out to be the other way round.

My sincere thanks to the open source community and all the others who have been directly or indirectly making a difference to the industry.

For Web related Test Automation, its worth exploring Sahi. That’s all I needed to say. Here is how: practically demonstrated.

  1. Just download from sourceforge and unzip the installer in C: or whatever drive you wish to.
  2. Go to the bin folder and double click demo.bat, in case you want to see a demonstration and play with it.
    1. Here is how it works: uses proxy server as a port to communicate 9999
    2. Based on rails concept of constant integration. Which means as you keep adding scripts, just need to put them in the scripts folder and it takes care of the rest. NO

      compilations and installer builds and so on. It happens to be based on interpreter concept. Below is the directory structure for better visualization and understanding.

      Sahi Support for Integration

      Sahi Support for Integration

      Note: There are lots of other dependencies that need to be taken care of before make it work in the first go. And you really do not get the bells and whistles of the other traditional

      test automation tools. Mentioning here is going to be too much. Please refer to the flash tutorial available on the sourceforge download site of sahi

      Lets Hit Implementation:

      Using Sahi for Performing Search and displaying the test results.

      Test Plan:
      Pre-conditions to run the test:

      Sahi installed in the directory and the machine has jre installed (run-time environment) to use sahi and the port settings configured to use proxy server with port 9999

      1. Invoke the browser.The browsers hould get invoked.
      2. Navigate to sahi\binfolderanddoubleclicksahi.bat
      3. The following screen is displayed.
      1. Notice the screen contents, mostly self explanatory.
      2. As displayed in the screen, pressing the control key, double click the browser.
      3. It will invoke the Controller Window (The recording brain of Sahi). Please refer to the illustration
Sahi_CLI

Sahi_CLI

 

  1. Move the controller window on the browser, pressing the control key move the mouse over various fields/controls in the site. As you keep scrolling, you will notice that the accessor (identification names also keep changing to the ……
    1. Go to google.com
    2. Click Record
    3. Search for a string
    4. Hit Return
      Click the Stop button.
    1. Refertothecodethatthescripthasgenerated.

    Now comes the Verification part:

    1. Go to the playback and invoke the controller window
    2. Specify the url (web url which you need to navigate to) google.com in our case.
    3. ClickRun.
    automating_google_using_sahi

    automating_google_using_sahi

    4. Record/Notice the test result

    Trust me, it will be a breeze and a flawless run.

    5_sahi_execution_results

    5_sahi_execution_results

    The results captured (as default sahi settings are) displayed in the Test Results Window above.

Submit a Comment

Your email address will not be published. Required fields are marked *

Skip to toolbar