testinganswers.com

Month: August 2019

17.2 User Interface Map

17.2.1| Creating a UIMap class to read locators from UIMap.properties fileNow we will build a UIMap class to access locator information from a properties file.   UIMap.properties example part-1   UIMap.properties example part-2   UIMap.properties example part-3 17.2.2| Creating a sample TestNow let us create a sample test that would use the UIMap properties file and UIMap class file to locate elements.The following example opens amazon.in the login page and then uses the UIMap file to locate login page elements. Sample Test  

17.1 User Interface Map

Selenium WebDriver API uses locator information to find elements on the page. Defining the locator information in the classes may result in duplication of element location information in various classes. Because of such duplication, it becomes increasingly difficult to maintain tests as the size of the test suite increases. Any change in element locator information requires updating of the element locator information in all the classes wherever it has been defined. Identifying classes which require an update and then updating them is a very time consuming and difficult task. In short, change identification and change implementation become a nightmare.   Read More

16.2 Annotation

16.2 | Custom Annotations Java provides the flexibility to define custom annotations as per need. An annotation is defined with the at-sign (@) preceding the interface keyword. The following steps show how to create and use custom annotations. Open Eclipse Select the package where annotation needs to be created. Right-click and select New → Annotation as shown in figure   Creating a new annotation file Specify annotation name say RegressionTest. The following code shows the annotation code with no annotations and parameters.   RegressionTest Above annotation can be directly used in code as:   Use of Annotation Annotate the annotation as required. Read More