Sahi Documentation

Best Practices

It is trivial to write automation scripts with Sahi. However once your scripts grow in size, you will realize that maintaining a large suite is hardly trivial.

We recommend the following for maintainable test automation.

Basic Recommendations

Advanced Team Recommendations

Language Recommendation

We recommend using the Javascript (Sahi) version for automation. Since Sahi controls the execution of such scripts, it is easy to do a lot of operations like automatic logging, code folding in reports, distributed playback handling etc. internally. Javascript as used in Sahi does not need as much programming expertise as Java. If you are using the Java driver, we recommend you to use it with Sahi's Scenario files. It will give you the same mentioned benefits as a Sahi script.

If you are using the Java driver WITHOUT Sahi's framework, please read below:

The Java driver is bare bones libraries to launch a browser and perform actions on it. If you use it you will have to do everything else that is needed as a framework. Eg. logging, reporting, storage of reports, building UI for viewing historic reports, building suites, running them in parallel, running them across machines as a distributed playback and collecting reports, provide an Excel like interface, allow auto discovery of functions, keep code and testcases separate, maintain object repositories or page object patterns etc.

Almost 70-80% of your effort in automation will go towards building all these peripheral components. This also means specialized skills are needed in your automation engineers. Sahi Pro already has all these features and more in its Javascript version. We have been evolving with our customer requirements and most of what you need would mostly already be there. It even has a good editor now which will report errors as you work on the file, suggest functions and function parameters, report if a function is misspelt or missing and a lot of other features. Mostly people look to java to build a framework and to allow use of good editors. Both of these have been addressed since Sahi Pro 6.1.0. The JS version can also call and reuse any Java code or libraries, so you can have the simplicity of JS but also use the power of Java when needed.