Site icon Vinsguru

Selenium WebDriver – Creating a Keyword Driven Framework for Localization Testing

In this article, I would like to show how I have implemented my Keyword driven framework using Selenium-WebDriver for automated localization testing of a web based application.

Localization Testing can be defined as a process of customizing a software application to support any language. In localization, native language string is translated to target language & software GUI is modified appropriately & the different functionalities of a software application is verified for a particular locale. It includes verifying all the content translation, date format, number format, currency format, images, online help documents etc for the target audience.

Finalize Scope: Before working on the framework, at first, we need finalize the scope of our localization testing – (It is applicable for any work – not only for localization testing). For ex, languages to be verified, platform to be tested, functionalities to be covered as part of automated testing etc.

Identify the Test cases: Once the testing scope has been finalized, Identify the test cases to be automated. It should cover all the labels, images, number & date formats, currency formats, UI element’s field level validation, error messages, documents, help contents. The application should be able to handle all the special/accented/non-English characters properly.

Language Translation: Once the test cases have been identified, prepare a spreadsheet/property files which contains all the translation for each content of the application for the different languages, the application will support. (In my case, I get a spreadsheet from the BA in below format which I can directly include in my project).

The above key-value mapping is for the below page in our application.

For US English users  :  

For Spanish users     :   

 

Keyword Driven Framework: It is also called table-driven framework – in which the test script for an application is created using a set of keywords in a table format (usually using spreadsheet). This framework does not depend either on the automation tool  or the actual application under test itself.

Even though Keyword driven frameworks might take more time to create, there are many advantages in the framework.

Sample Keyword driven localization test script:

Step Step description for reporting purpose
Object Name Either object property of an element / Variable name containing the properties to find the element.
Action Action to be done on the element. like Click on a button, Enter some value in thetextbox etc.
  • In my Keyword Executor library – VerifyText action compares the innertext of the element against the vale in the ‘Param‘.
Param Parameters to be passed to the action.
  • ${label.new.examinee.firstname} : Contains the key from the translation file. So based on the language passed to the test, it reads the translations from the spreadsheet for the given key.
  • #{VARIABLE} : Any variable.
  • TEXT : If the Param does not have ${..} or #{..}, then the value in the cell is considered as the parameter to the action for the step.

 

Identify the Web Elements: In automated testing identifying a right test element is very important. We need some properties like id, name, xpath etc to uniquely identify an element. As I was a HP’s QTP (now it is called UFT) user before, I like its Object Repository concept to keep the properties to identify an element away from the test script. So, I create separate properties file for each page of the application – I still use Page Object Model. But properties are not hard-coded in the class file itself & instead it is read from the properties file – so that I do not need to build the class files in case of property change.

Sample Object Repository file for the above page:

 

How It Works:

KeywordLibrary should handle all the possible actions. For example – ‘VerifyText’ – the below piece of code gets executed everytime.

 

High Level Framework Design:

 

Summary:

Thus a keyword driven framework for localization framework is implemented – all the test scripts are executed for the given test Environment, for the given Browser & for the given Language by the user using Jenkins.

 

 

Happy Testing 🙂

Share This:

Exit mobile version