Beyond Functional Testing: Web Consistency Testing

Functional testing done correctly is very powerful, but it is limited. It verifies that the system is functioning correctly (a very important attribute), but it doesn’t do any verification of usability or appearance.

Enter Web Consistency Testing. The video on the main page gives a very good view into the approach.

Currently, most developer’s develop in their favourite browser until the site looks the expected way. Once that is complete, the site will be checked against another browser and any discrepancies corrected. Continue this process across supported browsers (or wait until someone else notices an issue).

Needless to say this process is very time consuming, prone to errors, and not as thorough as it could be.

Web Consistency Testing is about automating this process. Attempts have been made to do this using image comparison, but depending on site changes (think rotating ads, carousels, browser differences), image comparison can be very fragile. The BBC has written a framework for image comparison that works well for them [elink link="https://github.com/BBC-News/wraith"], but it does require a number of servers, and compares two environments, highlighting differences.

Some problems with this approach include false negatives and difficulty narrowing down the actual discrepancy.

Web Consistency Testing uses the DOM for comparisons. It will parse the DOM, determine locations of items, and use that for comparison. It will also use offsets so that if an item higher in the DOM is out of position, all items below will be offset accordingly so that they are less likely to produce an issue. This really assists in finding an actual discrepancy.

A specific implementation is available at Mogotest. Mogotest leverages a number of open source projects, as well as Cloud servers to evaluate across various browsers, including mobile. It attempts to mimic the developer workflow by using one browser’s rendering as the reference, and then reporting on discrepancies from one run to the next, as well as discrepancies across browsers.

Because it’s leveraging Cloud, it is also able to support many browser/OS combinations, including mobile.

One could duplicate Mogotest’s functionality as it’s primarily built using open source technologies, and readily available Cloud Services.

A very interesting approach to visual verification of a site, and one I will be investigating further.

  • Web Consistency Testing: [elink link="http://webconsistencytesting.com/"]
  • Mogotest: [elink link="http://mogotest.com/"]

Java: Optional.isPresent() is not the best usage of Optional

Using the Optional class from Guava or JDK8?

The TL;DR: If you’re using isPresent(), you’re not taking full advantage of Optional.

Optional allows one to explicitly state that a variable may not have a value rather than relying on comments/code convention and null values.

It provides a number of helpers for constructing Optional items. Optionals are basically a wrapper around an object, and can either be ‘absent’ or ‘present’.

Optional provides an ‘isPresent’ method, but if you’re using it, you aren’t taking full advantage of Optional. Using isPresent isn’t really any different than using {var} != null from a coding perspective.

The Guava Optional provides several methods for retrieving items. If you know it will always have a value (likely due to previous checks), you can use get().

If you’re not sure if it will have a value or not, and want the default returned to be null, use orNull(). There is also an or(defaultValue) that will return defaultValue if it isn’t defined and an or that will return a different Optional value.

The JDK8 version of this is more powerful, but this at least gets one started. Here’s a great post about the JDK8 Optional:

[elink link="http://www.oracle.com/technetwork/articles/java/java8-optional-2175753.html"]

Let’s Remember the Real Agile Manifesto

Inflexible Agility. This article is true too often. The focus in agile is not the process, and yet process is talked about more than people, interactions, working software, customer collaboration and responding to change.

Let’s remember those, and not focus on processes. Processes can help, but are secondary.

[elink link="http://java.dzone.com/articles/inflexible-agility"]

Groovy for Android Development

Apple recently announced the new programming language for iOS called Swift. One of the languages mentioned by Apple as providing inspiration was Groovy.

Here’s a presentation showing how to use Groovy for Android development. Looks a lot nicer than using Java for it. Take a look and see what you think. I’ll be investigating this for any Android development I have to do.

[elink link="http://melix.github.io/blog/2014/06/grooid.html"]