Compared to other web testing tools, Sahi controller (IDE) can be used in various browsers.
Sahi's APIs do not depend much on the HTML structure. Sahi does not use XPaths and has APIs like _near, _in etc. to help finding one element in relation to another. Even if the structure of the page changes, these work properly. Our client website is an ExtJS site; Sahi is helpful in dealing with the changing pages.
First of all, we can download the latest Sahi zip file from sourceforge. The prerequisite for Sahi is JRE 1.4 or above.
After finishing the setup, we can start creating scripts. The scripts can be written using any text editor with the facility of recording by controller. Press ALT and double click on the window, which you want to record.
The controller is as below
Note that custom code can be tested, by entering code in the "debug" text area and clicking on "Test->". The command will be executed and the result will be displayed in the textbox near the” Test->"button.
Once confirmed that the desired result has been achieved, that code snippet can be added to the recording by clicking "Append to Recording".
Multiple tests can be run through ant. For each test in the suite, the ant target opens a browser, runs the test and closes the browser. The ant target specifies a suite file, say SuiteName.suite.
Sahi has some inbuilt features for data driven testing. Sahi can read and write to CSV (Comma Separated Value) files, databases and Excel sheets.
View Sahi in-detail with more examples in part 2 of this article.