Sahi Framework
abstract
The Sahi Framework allows testers to write their testcases in Spreadsheet (Excel like) format and run it from Sahi.
Often a testing team consists of a mix of subject matter experts, some manual testers and testers with some automation
experience. Writing tests in the language of the business allows all stake holders to participate and
derive value out of the automation process.
Layers in Automation
Sahi Framework broadly breaks down automation code into 3 layers.Business Layer
This layer expresses business intent. It is agnostic of the UI, testing tool and interaction code.Eg.
Create User, Approve User, Login User
etc. talk in the language of the business, without assuming
anything about the UI, tool or code.
In Sahi, this layer is implemented as Scenario files. This is csv file which can be edited in our Editor or via MS Excel. A sample scenario looks like this:
TestCase | Key Word | Argument1 | Argument2 | Argument3 |
loadSahi | "books_lib.sah" | |||
Check shopping cart total | [Documentation] | Smoke test for add books | ||
login | "test" | "secret" | ||
addBooks | 3 | 2 | 1 | |
verifyTotal | 1640 | |||
logout | ||||
Implementation Layer
This layer implements the business keywords specified in the previous layer. For example,login
mentioned above, is implemented in books_lib.sah
as below:
function login($username, $password){
_setValue($_TEXTBOX_USER, $username);
_setValue($_PASSWORD_PASSWORD, $password);
_click($_SUBMIT_LOGIN);
}
Accessor Repository Layer
This is a place to keep all the Accessors (object identifiers). This is implemented as an Accessor Repository (AR) file. AR files are just simple Sahi script files with_AR.sah
suffix.
A sample AR file named cart_AR.sah
looks like this:
var $_TEXTBOX_USER = _textbox("user");
var $_PASSWORD_PASSWORD = _password("password");
var $_SUBMIT_LOGIN = _submit("Login");
Recommendations
- Read the Best Practices section