Best Practices using Canoo Webtest
Software Engineering
Best Practices using Canoo Webtest
Canoo Webtest is a good tool for functional testing of web applications. The test steps are specified as ant targets and tasks, which is xml based test specification. Since it does not involve coding in any programming language, it becomes very easy to iteratively develop and run test cases. In this article, we discuss some basic ideas to improve productivity of writing and maintaining test cases in Canoo Webtest.
- Use unique titles: Use unique titles for web pages. Verifying the title of a webpage which comes as result of a requested URL or form submit, is one of the easiest checks which can be made. Of course, some web results will have same title of page but different content. For these cases, extra verification of text, regex, or xpath expression on page should be done.
- Include i18n properties: If using a properties file for i18n support (e.g. one in struts or JSTL), include it as an ant properties file in the Canoo webtest ant script. Then in test steps, instead of using plain strings, use ${var} notation to include the string from the i18n properties file itself. This has great advantage in maintenance of the test cases. If the i18n properties file changes, the testcase will automatically include the changed value by reference. Otherwise, a testcase will need to be updated whenever some text on its web page changes.
- Group test cases into ant tasks or testsuites: Group different categories of testcases into composite ant targets using ant target dependencies. E.g., validation related targets could be grouped into one composite ant target which simply refers to these various targets using depends attribute of target. Similarly, one more level of hierarchy can be built. As another alternative to gropuing testcases, Canoo webtest also provides an inbuilt testsuite mechanism to group testcases (similar to JUnit).
- Iteratively code and test: Test Driven Development (TDD) is a part of agile development and a philosophy of writing code and unit tests simultaneously. Of course, it is easier said than done because of time pressures and time taken to update testcases in general. However, updating testcases in Canoo Webtest is a breeze and it is far easier to update a testcase whenver the code is changed than at later time. Since the testcases are easy to modify, it is quick and there is little advantage gained in waiting for a later time and updating many testcases in one go. If i18n properties are included in Canoo script as mentioned above, it reduces by 80% or more the grind work in having to manually update the testcases for every text change on a web page.

Recent comments
1 year 39 weeks ago