ArchitectureUnderstanding Sahi's architecture needs an understanding of the design goals of Sahi.
- The tool should be simple to use
- It should minimize coding/scripting effort as much as possible
- It should take care of everything other than the business logic itself, like logging, reporting etc.
Sahi is focused towards saving time for testers and developers. Sahi has an excellent recorder which quickly helps create snippets of script that can be executed as is or called from functions. Sahi takes care of reporting, handling suites, distributed playback across multiple machines etc. with minimal effort from the tester.
So the tool should be:
- Browser and Operating System Independent
- Should be able to work on mobile browsers without installing full software
- Should be able to accommodate new browsers or new versions of browsers without modification to script and minimal modification to tool.
So the tool should:
- Identify elements in an easy way, and provide ways to automatically identify.
- Should not use any existing libraries like jquery since the web application may use similar libraries and cause a conflict
- Identifiers should relate to the user interface
- Identifiers should work across browsers
- Event simulation should simulate the end user actions correctly across browsers.
- Should not need browser to be in focus, to allow parallel playback and reduce brittleness of tests
- Should not force users to do implicit actions like scrolling into view.
- Logging etc. should be taken care of automatically
- Scripting should allow easy reuse of existing libraries to do non-browser tasks
- Scripts should be version controllable and "diff"able
- Scripts should break minimally when user interface changes
- Suites should allow being triggered from build and Continuous Integration systems
Sahi Scripts are plain text files which can be version controlled. Sahi's APIs are fairly robust and can withstand peripheral UI changes. Sahi suites can be triggered from ant, batch files, shell scripts, from java code or just as simple URL calls.
- adds event handlers for recording
- adds Sahi's APIs for event simulation
- mocks some window dialogs like alert, prompt, confirm, print so that playback is not affected