This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.
Writing UI Integration Tests
This page will focus on the required knowledge on Selenium based UI testing and how to embark on writing selenium tests in WSO2 Test Automation Framework (TAF).
Selenium
Selenium can be described as a set of different software tools each with a different approach to supporting test automation, or in other words, Selenium can be used to automate browsers. In today's context, there are a number of commercial and open source tools available for assisting with the development of test automation. However, Selenium is possibly the most widely used open source solution. One of the key features of Selenium is that you can execute tests on multiple browser platforms. It also has high flexibility. These features were major reasons for embedding Selenium into the Test Automation Framework API, enabling its users to write UI based tests.
TAF uses Selenium 2 - Web Driver.
Selenium web driver
With the introduction of Selenium WebDriver API, you can overcome some limitations in the Selenium-RC API such as the Single Host origin policy.
For more details on Selenium browser automation, refer http://docs.seleniumhq.org/.
Page object models
A page object models the areas that your tests interact with as objects within the test code. The main advantage of page object models is that it reduces the amount of duplicated code and in case the UI changes, the fix needs to be be applied only in one place.
How Selenium works with TAF
When writing Selenium tests, one of the major concerns is the maintainability (in other words, how easy it is to maintain the code snippet). You may encounter a situation where you need to perform a minor modification to the UI model. Â Consider the modification needs to be performed to a xpath of a single link on your web page. This can cost you much, maybe even failures in every test encounter, due to this simple change.
In order to overcome such issues, TAF has inbuilt page object modules inside its API. In this context, a page is an object oriented class that works as an interface to a page of the application under test. The benefit of a page class is that whenever the UI changes, you do not need to change the test classes. Only the code within the page classes needs to be changed.
The page object models which consist of the page operations, resides in the Test Automation Framework. Maven is used as the build tool.
Example:
Â