Apr 30, 2014

Testing internationalization on the website with Galen Framework

There is one more thing that is possible to test with Galen Framework except layout. Since version 0.10.1 Galen Framework introduced a convenient way to test internatiolization. According to Galen official documentation you can test text for specific items on page. But what to do if there are multiple languages on the website and you want to test all of them? Here is a solution.

Since version 0.10.1 Galen Framework introduced “properties” action with which you can load properties into system from a specified file. As we want to test internatiolization we can prepare property files for different languages and then use them for a specific language.

Here we have two versions of page: an English version and Dutch version. Lets create some Galen tests for checking text on the header and menu items. First of all lets create a folder i18n and prepare two property files where we are going to store English and Dutch words:

English version in file i18n/main-en.properties:

i18n.main.header = My Website i18n.menu.main = Main i18n.menu.categories = Categories i18n.menu.aboutus = About us i18n.menu.help = Need help?

And the Dutch version in file i18n/main-nl.properties:

i18n.main.header = Mijn Website i18n.menu.main = Hoofd i18n.menu.categories = Groepen i18n.menu.aboutus = Over ons i18n.menu.help = Hulp nodig?

Now we can prepare a homepage.spec where we shall put the text validations

# Declaring locators for test objects on page ================================== header id header menu-item-* css #menu li ================================== header text is: ${i18n.main.header} menu-item-1 text is: ${i18n.menu.main} menu-item-2 text is: ${i18n.menu.categories} menu-item-3 text is: ${i18n.menu.aboutus} menu-item-4 text is: ${i18n.menu.help}

And now finally we can connect things together. Lets create a test suite where we shall parameterize our homepage.spec file. Create a file i18n.test in project folder

@@ table languages | language | languageFullName | | nl | Dutch | | en | English | @@ parameterized using languages Home page test for ${languageFullName} (${language}) language http://samples.galenframework.com/tutorial-i18n/${language}/index.html 1024x768 properties i18n/main-${language}.properties check homepage.spec

Thats it! now we can execute the tests:

galen test i18n.test --htmlreport reports

Here is the example of genereated reports

Posted in Galen, Web, Selenium, Automation
comments powered by Disqus