Currently Browsing

Cross-browser compatibility

Benefits of using default methods in interfaces (JDK8) in web testing with selenium

Programming language Java doesn’t allow multiple inheritances. Java uses interfaces to simulate multiple inheritances without importing its disadvantages. The cost of this is that method implementation was not possible in interfaces until JDK 8.

JDK 8 contains a new feature which allows us to create default implementation for interface methods. Simply just add keyword “default” before the method definition and add implementation body for it. With this, the method will have a default implementation and we don’t need to override them anymore. Basically, we went a step toward multiple inheritances.

As always, there are few disadvantages which came with this feature. We will get a compile error if we have multiple default implementation for the same method. It can be fixed by overriding the method with a new implementation or explicitly call the chosen default method.

Secure use of sendKeys() on pages created with Angular

We recently faced with an Selenium’s sendKeys() method issue which is related to the page which was made in Angular 1.5.8 (Most likely the same issue can be discovered in different versions). In most of the cases, the input field filled by sendKeys() method will contain just part of the desired text. Most often you will find just the first half of you desired text written into the input field. From our experience this bug appears only in the following circumstances:

  1. Page must be made with Angular
  2. The input field must be tagged with angular attributes, like ngModel, ngControl, etc.

Read out browser console logs in java with selenium 2.53.1

Sometimes the usual test log and screenshot is not enough to find the reason of the failed test case. Especially when the test case occasionally fails in special circumstances and it is really hard to reproduce. For this reason, we need to collect for each fail as much information as possible. One possible source of information is the console output of the browser.

Running webdriver code in JMeter

With the improvements in technology more and more of the business logic gets executed on the client side and it’s not easy to get a clear picture of the perceivable performance by using pure JMeter tests only.
To extend these measurements JMeter-Webdriver plugin in JMeter can be handy to run WebDriver tests using actual browsers and to get client side execution statistics.

In the following section I will demonstrate how to configure and run a simple WebDriver test in JMeter.

First you have to download the plugin from the JMeter plugin page and then copy the library files into JMeter installation folder.

From now on when you start up JMeter you should have the extra Config Element and Sampler components visible on the tool list and they are ready to use

Jenkins service VS Jenkins .war run

One of our recent project requited the setup of a new Jenkins on an AWS Workspace instance with Windows 7 OS. The task was not particularly hard, just a basic setup for fetching and compiling a repo, building and running Selenium tests.

After installing and setting up the service version of the Jenkins everything was fine: the build was successful and the logs appeared on the console as it was expected. After a while a strange thing happened: no browsers appeared although the logs confirmed that they were started, all the tests were running correctly and all of them passed at the end of the run.

Cross-browser compatibility test using virtual machines

In my previous post I described cross-browser compatibility testing using online services. This time I will focus on cross-browser testing using virtual machines.
To be sure that your application will work as expected, you will need to test it in every supported browser/operating system (this means different versions of different browsers and different versions of operating systems installed)
To install different versions of browsers on different versions of operating systems you will need many virtual machines.
The disadvantage of having virtual machines locally is that you should have an advanced configuration, where you can run these virtual machines.

Cross-browser compatibility test

It is important to test a web page in different versions or releases of a web browser, including differing versions within a single browser offering (especially Internet Explorer). Internet Explorer has various versions still actively supported.

It is impossible to install all browsers on one machine. To install different versions of browsers on different versions of operating systems you will need many real/virtual machines.

There are many online services for cross-browser compatibility testing, too.

Made a little research and I decided to test CrossBrowserTesting –