Automation Testing

Sahi for Web Application Automation

By Test Guild
  • Share:
Join the Guild for FREE

I often get questions about which tool is better for web application automation. The answer is always that it depends on your situation.

I recommend looking at what already exists before developing something new. (Check out my article Six Open Source Test Tools You Need to Know.)

I do mention Sahi in that post. But after interviewing Narayan Raman, Sahi’s creator, I decided to offer a more in-depth look.

What is Sahi?

The first thing you need to know is that Sahi comes in two flavors: open source and a pro version. Sahi Pro is the enterprise version of the open-source project. It includes lots of features coveted by larger organizations.

For example, compared to the open-source version the pro version has better:

  • Parallel Testing
  • Reporting

Parallel Testing Differences

With Sahi Open Source, you can run your test in parallel on a single machine. But what if you need to do something more complicated? Let's say you have 1,000 scripts and you want to execute 25 of them in parallel?

For that type of functionality you’d want to use Sahi Pro. The pro version takes care of the distribution, execution and consolidation of reports automatically. With the open-source version these would all be manual activities.

Better Reporting in Sahi Pro

Another benefit of the pro version is reporting.

There are lots of just HTML files in Sahi Open Source that you can use for reporting. Creating reports, however is a manual process.

In Sahi Pro, the result files are more configurable and the data is also stored in the database. Having a database gives you the ability to access metrics and graphs of your test runs. The historic view also shows how your automation suite is progressing.

Why was Sahi Created?

In 2005, Narayan was working at ThoughtWorks.  Although they were trying to do lots of things in Agile, there was a problem. They noticed that while development was happening at a much more rapid pace, the testers weren’t able to keep up. They realized that to be more agile they needed more light weight test tools. So they decided to ditch their clunky vendor test tools for something easier to use.

Narayan had a background in proxies and JavaScript and decided to create his own tool. His main goal was to make it easy for testers to record and play back tests. Thus Sahi was born.

What’s the Difference between Selenium and Sahi?

The development of Selenium was going on at ThoughtWorks around the same time, but Sahi had a different focus; it was created with testers in mind, which is why Narayan made it as simple as possible. Many testers are not developers, which is one of the main reasons that lots of Selenium projects fail.

How does Sahi Work?

Sahi uses a small proxy server that runs on your machine. All the browser traffic goes through this proxy and as a result, Sahi is able to inject JavaScript onto the web page. That JavaScript allows you to do all the automation.

This is similar to Selenium RC, except that Sahi doesn’t rely on technologies like Xpath or CSS selectors. Instead, a tester doesn’t need to know much about an application.  Since the tool injects JavaScript into the web page, there’s more control. Any element that is of interest to automation will always have something to help identify it. A tester does not need to go back to a developer for nearly as often. The tool itself figures out which elements it needs to use to interact with a control.  This makes the recorded elements stable in the sense that they don’t change very often.

Sahi also takes care of waits. For example, it will wait for things like page loads or Ajax activities.

Isn't Using a Recorder for Automation a Bad Thing?

Narayan doesn’t feel that a recorder is always a bad thing. The goal with Sahi is to make the recorder a useful utility. Since Sahi is for testers and not developers, it allows non-technical folks to create maintainable scripts. Thus, testers can focus on testing instead of programming. The tool itself attempts to take care of most of the complexities.

What Tool Should You Use for Test Automation?

What is important for the business? That’s the one question Narayan asks himself when choosing a tool for automation. Too often, folks select tools or languages as a way to boost their resumes. Don't be one of those testers. Check out Sahi and see if it’s the right tool for your business.

Narayan Raman Sahi

  1. I am facing the following problem. Can you please help to resolve this. I am using the following code to highlight browser instance (only 1 browser instance exists)
    Browser(“CreationTime:=-1”).highlight
    Sometimes the code is highlighting the only browser instance available while sometimes it is showing “No object found”. I have read in QTP unplugged by tarun lalwani that if 1 browser instance exists then Browser(“CreationTime:=-1”).exist(5) will return true. Please tell what i am doing wrong or understanding wrong here.

Comments are closed.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

DevAssure Review: Cut Testing Time Using Low Code Automation?

Posted on 12/11/2024

As you know, testing often becomes a bottleneck in software development due to ...

Leveraging AI and Playwright for Test Case Generation

Posted on 11/22/2024

Two BIG trends the past few years in the software testing space been ...

Symbolic AI vs. Gen AI: The Dynamic Duo in Test Automation

Posted on 09/23/2024

You've probably been having conversations lately about whether to use AI for testing. ...

Automation Guild '25 Online Event - Registration Kickoff Special (Limited Time) - Elevate your E2E testing skills in 2025 >>