What is the problem we solve?

Organizations which create or maintain web applications need to test a lot of functional flows before releasing a new version of the software. Typically a manual tester would sit and test the features before release and this can take up to a month of effort, and is prone to human error. When fixes are rolled out for bugs in this period, those functionalities need to be re-tested and verified, adding to the testers work load. Automating known work flows can easily bring down the testing from 1 month to a matter of days.

Testing repeated steps is also a drudgery which can be alleviated by automation, allowing testers to focus more on creative exploratory testing.

Specifically In the web domain, there are a profusion of browsers (Internet Explorer, Firefox, Chrome, Safari, Opera etc.) on which the end user may access the application. Browsers can differ from one another in the way they behave causing an application to work on one browser but not on another. Application developers need to test the application across browsers, thus multiplying the testing effort. Sahi Pro allows users to develop automation scripts which can test applications across browsers and report failures.

Let us see how Sahi addresses common test automation problems:

There are a lot of browsers and they need to be tested for functionality
Sahi Pro works across Browsers and Operating Systems. Scripts written for one browser will work on another browser without modification

Web applications can be complex. Is it tough to get started?

Sahi Pro’s Controller comes with a very good Recorder, which will help quickly come up with test cases. The recorder also helps identify elements on the browser and test Sahi commands instantly. The Sahi Pro Controller works on all browsers and Operating systems.

But Record and Playback is frowned upon? Is it good to rely on Sahi’s Recorder?

Record and playback is just a stepping stone. It lets users quickly come up with the first cut of their testcases. For maintainability one needs to restructure their code into reusable functions. Having said that, using the Recorder to identify elements, record actions and experiment with Sahi code can save tremendous amount of time. For a single step or for a few steps, a recorder is really useful. It auto generates the code that you need. You can then copy paste it into your reusable functions and parameterize it.

Identification of elements on the browser has been a problem with other tools? How does Sahi handle element identification?

Sahi uses the various DOM properties of an element for identification. Over that Sahi also has nice APIs like near, in, under etc. which lets us identify one element with respect to another. For example, a textbox near a label can be identified as

_textbox(0, _near(_label(“Username”)))

What about elements with dynamic ids, where the ids change with each page load, or with each version release?

Sahi does not solely rely on ids for identification. It uses many other DOM properties, with emphasis on visible text. Sahi’s relational APIs like in, under, near etc. help identify one element with respect to another.

Why do applications generate dynamic ids? We are building our web app in house, so why would this situation arise?

There are 2 types of dynamic ids generated. One which comes up because the application uses 3rd party widgets like ext-js, zkoss, gwt etc., which automatically generate unique ids on the browser. Your developer does not have full control over these. Even if he did, it is a waste of time to try to control that. With Sahi, some part of the visible text will be used to identify the rest of the component. For example, in a tree control, a + icon near a text span may need to be clicked, which may be done using _image(“plus.gif”, _leftOf(_span(“Folder 1”)))

The other type of dynamic id is when there is a list of items being displayed and each item has unique ids against them. But fortunately, at least one piece of information will uniquely identify each row. For example, if it is a list of user names with edit, delete links against each, Sahi can use the username to find the edit and delete link near it.

Why does Sahi not use XPaths for identification?

Using XPath leads to brittle, unmaintainable and slow tests. XPath is used to traverse XML structures which represent data. An HTML page is not data. It is a visual representation of data and is prone to modification. Further XPath is not natively available in browsers. One may need to use external libraries for it. Browsers also have differences in their implementation of XPath.

Why is Sahi’s identification better? If it does not use XPaths, what does it use?

Sahi uses wrapper functions around the javascript DOM. Javascript is the native way the browser exposes its DOM. All browsers will necessarily support it and optimize it for performance.

Why do we need to use wrappers then? Why can’t we directly use the browser’s javascript APIs?

Unfortunately, browsers differ in the way they expose the DOM. One needs to write wrapper functions to make the script across browsers. Sahi’s APIs does this normalization very well.

How does Sahi work?

When we start Sahi, a small proxy server is started on port 9999. When a browser is launched from the Sahi dashboard, the browser is configured to use Sahi’s proxy. This causes all request responses to go through Sahi’s proxy. When the response is returned to the browser by the proxy, it injects javascript code into it. This injected javascript code allows Sahi to control the browser.

If I already use a proxy what should I do?

You need to configure Sahi to use your proxy. So, browser uses Sahi proxy, Sahi uses your proxy. Details: http://sahi.co.in/w/configuring-an-external-proxy

What applications will Sahi work on?

Sahi will work on all web applications which render on browsers. Your web application may be using J2EE, .NET, PHP, Ruby on Rails, Python or any server side technology. As long as the output is accessible via the browser, Sahi can automate it.

However browsers may render some content via plugins. For example, flex, applet, Silverlight etc. are some technologies which use browser plugins. Of these, flex and applets are automatable via Sahi.

Does Sahi support iframes, frames?

Yes Sahi supports iframes and frames. In fact Sahi automatically loops through all frames and iframes, so you need not explicitly add any script for handling frames and iframes.

Does Sahi support popup windows and modal dialogs?

Yes Sahi supports all of these. (alerts, confirms, prompts, popup windows, modals launched from showModalDialogs)

Does Sahi support HTTPS /SSL?

Yes Sahi works easily with HTTPS and SSL sites.

Does Sahi work with 401 authentication dialogs?

Yes, Sahi handles 401 authentication dialogs. It creates its own page with username and password fields, which can be automated like a normal HTML page.

What scripting language does Sahi use?

Sahi uses Sahi Script as its default scripting language. Sahi Script is just an extension of Javascript and supports all the constructs of Javascript.

Does it support other languages?

Sahi also has drivers in Java and Ruby. Note that the Java and Ruby drivers let you control the browser, but do not have any of Sahi’s features like automatic reports, distributed playback etc. You may need to write your own framework or use some else’s framework if you use the java or ruby driver. Sahi’s also has a PHP driver which is written and made available by folks from Symfony.

Does Sahi support data driven testing?

Yes, Sahi can read and write databases, excel sheets, csv files and plain files.

Why does Sahi use a javascript like language as default and not some other language like Java or C#?

The common language used on all browsers is Javascript. It is also one of the simplest yet fairly powerful scripting languages in the world. When your team/project moves from one back end technology to another, the testers should be able to test the web applications irrespective of the back end technology. Testers are not encumbered to learn new languages when the front end is the same browser.

But Javascript has its restrictions. It cannot read from the file system etc. Does Sahi have these restrictions?

Javascript on the browser is subject to browser restrictions. Javascript as a language does not have these restrictions. Sahi’s Javascript primarily executes in a Java process inside a Rhino Javascript engine. It has access to everything that Java has. Only statements that need to execute on the browser are sent to the browser and executed there. That is the reason Sahi is able to read/write files, databases etc.

What is the general usage path for teams using Sahi?

1) Record the first script and play back from the Sahi Controller

2) Add a few more scripts and execute them from the Controller

3) Modify slightly and make sure tests are repeatable.

4) Experiment with Sahi Excel Framework and check if it is suitable for team

5) Create a suite file, add the created scripts/excel files and run them from command line.

6) Run from ant, integrate with continuous integration system like Jenkins

7) Add more scripts, start version controlling the scripts itself and execute longer running test cases.

8) Build time increases, so break into separate suites for smoke tests and complete tests.

9) Distribute tests across machines to reduce playback time. Also configure auto retry.

How does it compare to Selenium?

Selenium 1 is not under active development and Selenium 2 uses the Webdriver technology. Webdriver uses native wrappers around browsers to be able to automate them. This ties Webdriver too much to the implementation of the browser itself. The Webdriver team has now made it a W3 standard and the onus has shifted on the browser vendors to implement and expose these APIs. Webdriver is still a work in progress. Tyto has started working on an implementation of Sahi which uses Webdriver underneath, so when this technology becomes stable enough, our users will be able to transition smoothly underneath to the Webdriver implementation. Currently Sahi is superior to webdriver because of the following reasons:

1) Better location strategy. Webdriver still uses XPaths, css selectors, ids.

2) Better wait mechanism: Sahi can automatically wait for AJAX requests while Webdriver cannot. Code needs to be written to correctly synchronize every AJAX call. This can be abortively expensive to write and maintain, especially by a testing team.

3) Sahi can work without browser focus, while Webdriver cannot, causing flakiness in tests.

4) Sahi can run tests on multiple instances of a browser like IE in parallel, which Webdriver cannot

5) Sahi’s APIs are simple and geared towards testers. Webdriver insists on developers building frameworks on them before it is consumed by testers.

6) Tyto provides support with Sahi Pro

What kind of support is available?

Support is provided via email with a guaranteed response time of 1 Indian business working day. If needed, we use GoToMeeting to trouble shoot issues via desktop sharing.

How does the licensing work?

If you buy Sahi Pro version 3.5 in March 2011, you will get free updates till March 2012. You can continue to use the software after that, but you will not get support or updates. If you wish to continue to get upgrades and support after that, you would need to renew licenses.

If you have a 5 member testing team, you will need to buy 5 licenses. But you can use the same license for playback on multiple machines if needed (for example, with build farms or CI systems). If a team member is replaced by another team member, the same license can be used for the newer user, as long as the number of users remains the same.

After the first year, Sahi Pro licenses can be renewed at same cost/year for following 2 years. The price is subject to change after that.

Is there a trial license for evaluation?

Yes, Sahi Pro can be downloaded from here: http://sahi.co.in/downloads-archive/

A one month trial license can be obtained from here after registration: http://sahi.co.in/download-sahi-pro/

How do I purchase?

You can buy online from https://crm.sahi.co.in/pay/index.php/order/create

Or email sales@sahi.co.in with your query.

Should I automate?

If you are releasing features often and repeatedly verifying the same features with each release, you should automate.

How does Sahi help?

Sahi lets you automate interactions with the browser. Sahi scripts can run entire scenarios in a fraction of the time a manual tester would take.

What browsers and Operating Systems does Sahi support?

Sahi uses a combination of proxy server and injected Javascript to drive a browser. Sahi’s proxy is written in Java. So any operating system which has Java support and any browser which has Javascript support will work. This essentially covers all modern browsers and operating systems.

How does it compare to Selenium?

Sahi is easier to learn and use for testers. Sahi’s recorder works on all browsers. Sahi automatically waits for AJAX and page loads. It does not use XPaths, but uses more intuitive APIs like _in and _near. Sahi works well across frames, iframes, popup windows, sites with dynamic ids, https sites, 401 authentication sites etc. It has inbuilt HTML reports, and ability to run multiple scripts in parallel.

Sahi uses Javascript to drive browsers. Does it not have problems of same origin policy?

No, Sahi uses a combination of proxy server and javascript to be able to successfully talk between different domains.

Does it support web frameworks like GWT, dojo, extjs, zkoss etc.?

Sahi has been successfully used to automate applications built on all these frameworks. It can handle any Javascript framework because of its architecture.

What is the history of Sahi?

Sahi was started in 2005 by Narayan Raman while he was working with ThoughtWorks. Sahi’s aim was to address the limitations of Selenium and simplify web automation to make it easily usable by testers. Sahi became open source in October 2005 and has since evolved into a stable, mature testing tool.

2005 – Sahi started
2006 – Reached top 50 projects of SourceForge
2007-08 – Evolved and stabilized
2009 – Commercial support started which further stabilized and validated Sahi
2010

Won Safari Books Online’s Coder Challenge award
ThoughtWorks Twist integrated with Sahi to provide record and playback capabilities across browsers.
PushToTest’s TestMaker uses Sahi’s technology to create a next generation web automation tool
2011

Released Sahi Pro V3.5 and Sahi Pro V4.0
Added support for a host of new browsers and browser versions
KnpLabs folks released PHP driver for Sahi as part of their Behat project.

What is Tyto Software?

Tyto Software was founded by the author of Sahi in 2009 to help organizations achieve automation easily. Tyto provides products, services and training around Sahi.

Which companies use Sahi?

ThoughtWorks, S1, Deloitte, and some of the biggest service providers in India use Sahi.
A partial customer list of Sahi Pro can be found clients list page.

Is there a commercial version of Sahi?

Sahi Pro, released in August 2010, is a commercial version of Sahi. The current release is V4.3.2. A comparison of Sahi OS and Sahi Pro can be found here.

Are there commercial tools which use Sahi?

ThoughtWorks Studios’ Twist and PushToTest’s TestMaker leverage Sahi for web automation.

Does Sahi have drivers in other languages?

Apart from Sahi Script, which is like Javascript, Sahi has drivers in Java, Ruby and PHP. The PHP driver has been entirely written by the kind folks at KnpLabs (the same guys who wrote Symfony)

What are the support options?

Community support is available via the forums. Commercial support is bundled with Sahi Pro. Please email support@sahi.co.in with your Sahi Pro queries.