You might encounter the situation where you employer points at you with a grim expression on his face. His daemonic voice seems to come from deep within your head:
"Our Usability Tests are too expensive. You have to automate them!"
Whether this scenario is realistic or not, you might evaluate Sahi for test automation. Here is what you should think about, when considering the Open Source version of Sahi for automating the usability tests for you web application.
The Environment
The Application Environment
Sahi is operating system and browser independant. Most certainly, the application under test is running in a browser. While the
Sahi homepage states, that Sahi supports every browser and AJAX and highly dynamic web applications and ..., you might encounter some problems with the following technologies:
- Your application is only accessible via VPN or a proxy: This does not seem to work in a few cases, most of the time due to bad configuration and you can get good support in the forum. Other times... it just will not work.
- Internet Explorer: You may have expected it, the Internet Explorer is kind of special as usual. Lately, some users report difficulties with browsing pages or invoking the Sahi Controller. Some recorded scripts work well on every browser but the IE.
- Some Dojo Widgets are difficult to test with Sahi. Reports in the forum mention problems with the dijit.form.DateTextBox and some workarounds.
- The GWT DatePicker is not fully accessible.
- Some Record/Playback difficulties exist when testing an Extjs application
- Flash Support: Just forget about it.
Developing Environment
Sahi works on many browsers and operating systems. The Sahi Controller provides an easy way to record and playback tests. For serious automation you should develop your tests in a proper IDE. Sahi supports syntax highlighting and content assist in Eclipse, Notepad++, Textpad and jEdit.
Choose some kind of source control.
Where is the testdata stored? Sahi is capable of reading excel sheets and csv files but doesn't provide any database connection (Sahi Pro does).
Choose a language to develop your tests. Testscripts can be written in Ruby, Java or JavaScript.
Custom Libraries
It may be beneficial to wrap the Sahi APIs into your own library to easily add further functionality. You may want to add some error checking or logging.
Reporting
Write Your Own Reporter!
The Sahi log html files are good for evaluating single scripts, but in the long run you will end up searching a long list of tests and a huge html file for a specific line. Writing your own reporter gets even more important, when someone is evaluating the test outcome, who has no understanding for the Sahi APIs. This person may tell if a test failed or not, but what has been tested and how, one can not tell. There should be a possibility to generate a business report which is is understandable, even if the reader does not know.. or just does not care about the codebase.
You have different options to do so:
- Develop a log writer within the test codebase like this XML fragment writer. This may not suffice for your needs and adds a lot of overhead as you have to get the "result" from within the test.
- Parse the Sahi generated logs. Sahi generates Html and Xml logs and you could use some text parsing tool to extract all the information you need. But you are limited to the information these logs provide and you have no influence on the changes these logs may go through in the upcoming Sahi versions.
- While Sahi Pro has the capability to report to a database, this feature is missing in Sahi OS. Write you own reporter package and build it into the Sahi source code, which is not that easy. The source is not modular and it looks pretty hard to add features. For a partial open source project, it should be easier to attach a different reporter. When you know the different locations, where to patch in your reporter, you have full access to all information within and after a testrun. This too may get you into trouble on new releases.
Test Case Management
Somehow you have to keep track of the test coverage, which testcases are implemented and how long it will approximately take to reach the coverage you are aiming to. A wiki, an Excel Sheet or a ticketing system might not be the right way to document your
testplan. Adding, changing and removing testcases, scheduling and keeping track of results is pretty difficult. A database may be easier to maintain but is better used in combination with a Test Management Tool. A list of Open Source Software can be found
here. I did not have the time to find out, which tool possibly is the best in combination with Sahi, so I am not recommending any tool. If you have some experiences with test management tools which work well with Sahi, please leave a comment.
Thanks for reading.
When you encounter any typos, if I raised a question somewhere or if you want me to explain some things more detailed, feel free to leave a comment.