Idiom for Browser-Selectable Selenium Tests

For some time I’ve wanted to share an idiom I personally use and recommend when building Selenium Tests. This idiom allows to control which browsers are used to run the tests without needing to update test sources or configuration.

The simple ideas behind this idiom are:

  • Test code and configuration should not depend on the test environment.
  • Tests can be executed in any given browser, independently from others.
  • To change the browsers used for test execution, it is not needed to update test sources or configuration.
  • Selenium Grid URL and application URL are also configurable.
  • Both environment variables and Java system variables can be used.
  • All settings have sensible defaults.

I call this idiom ‘Browser-Selectable Tests’. I promise I keep thinking on a better name :-)

Continue reading

Installing Sonar in OpenShift as a DIY application

Note: this is an excerpt extracted from my talk at Red Hat Developer Day London. You can see more about the talk in my post here:

http://deors.wordpress.com/2012/10/03/developer-day/

Sonar is a popular code profiler and dashboard that excels when used along a Continuous Integration engine:

  • Seamless integration with Maven.
  • Leverages best-of-breed tools as Checkstyle, PMD or FindBugs.
  • Configurable quality profiles.
  • Re-execution of tests and test code coverage (UT, IT).
  • Design Structure Matrix analysis.
  • Flexible and highly customisable dashboard.
  • Actions plans / peer reviews.
  • Historic views / run charts.
  • Can be used with Java, .Net, C/C++, Groovy, PHP,…

Continue reading

The Usual Suspects – Talk in Red Hat Developer Day London, Nov 1st

On Nov 1st, I will be presenting in Red Hat Developer Day London.

The tittle of my talk is: “The Usual Suspects – Creating a Cloud Development Environment with Sonar, Selenium and JMeter on OpenShift Origin“. During the session I will show how to extend the basic development environment offered by OpenShift (Git, Maven, Jenkins) and create a more powerful environment on OpenShift featuring “usual suspects” such as Sonar for continuous quality assurance, Selenium for functional testing, JMeter for performance/load testing as well as Arquillian for in-container testing. The session includes a live demo built on OpenShift Origin.

For more information about the event, full agenda and registration, visit: http://www.redhat.com/developerday/

See you there!

Edit 2012-11-01: These are the slides for the presentation. Meanwhile they are published in the conference site I have uploaded them here: The Usual Suspects – Red Hat Developer Day 2012-11-01

 

First Steps with Heroku – The New-Old Boy in the Cloud

Since my previous posts about Java cloud platforms I wanted to expend some time with Heroku and compare with the others.

Heroku is a veteran among the cloud platforms, but it’s not until a few months ago that they launched a Java offering.

In this post I will share my experiences starting with Heroku and making an existing application to work on it.

Continue reading

Test Automation with Selenium WebDriver and Selenium Grid – part 3: Continuous Integration

In part 1 in the series (read it here) I discussed about Selenium, the widely used tool for browser test automation, and I showed how easy is to setup a testing grid with multiple OS and browsers. In part 2 (read it here) I showed how to leverage WebDriver API to create and execute tests distributed across the grid that was created.

Now in part 3 I will show how to execute Selenium tests under a Continuous Integration process with Maven, Cargo and Jenkins, and how to gather code coverage metrics for those tests using Sonar and JaCoCo.

Continue reading

Test Automation with Selenium WebDriver and Selenium Grid – part 2: Creating and Executing Tests

In part 1 in the series (read it here) I presented Selenium, a widely known tool for browser test automation.

Starting with Selenium 2, the most important components from the suite are Selenium WebDriver and Selenium Grid. In part 1 I showed how easy is to setup a testing grid with multiple OS and browsers. Now in part 2 I will show how to leverage WebDriver API to create and execute tests.

Continue reading

Test Automation with Selenium WebDriver and Selenium Grid – part 1: Setting Up the Grid

For a long while I’ve been “dying to play” with Selenium (www.seleniumhq.org and code.google.com/p/selenium/). I’ve heard and read very good things about this tool from colleagues and from the blogosphere.

Selenium is, in short, an open source tool to automate web browser interactions. A primary use case is, of course, browser test automation.

Selenium has greatly evolved with time, specially since the 2.0 release when the legacy Selenium project merged with Google’s WebDriver. Nowadays, Selenium offers a wide range of programming languages supported to write the tests, an impressive browser compatibility list, the ability to record tests from user interactions and, above it all in my opinion, the ability to re-execute tests across a grid of machines with various operating systems, browser families and versions.

Although Selenium seems to be primarily chosen for functional/regression test automation, it’s also a great choice – precisely because of the grid feature – for cross-browser compatibility testing: ensuring in an easy, cost-effective way, that our web applications are usable in all sorts of operating systems and browsers.

In this and forthcoming posts in a short series I will share my experiences setting up a Selenium Grid, building some automated tests for a simple Spring application, re-executing them from Eclipse IDE and finally re-executing them in continuous integration (including code coverage) with Maven, Cargo, Jenkins, Sonar and JaCoCo.

Continue reading

Red Hat OpenShift: Freedom of Choice

1         Introduction

After we finished writing the post on VMware Cloud Foundry platform, it seemed natural to write a follow-up on Red Hat OpenShift. OpenShift is a Java-based Platform-as-a-Service (PaaS) offering from Red Hat, the ‘giant’ of Open Source Software with a well-deserved reputation that comes from a wide range of products including operating systems (Fedora, Red Hat Enterprise Linux), application servers / middleware (JBoss AS, JBoss ESB), frameworks (Hibernate, Seam) and tools (JBoss Tools, Arquillian).

As a PaaS offering, the ultimate goal of OpenShift is to reduce the effort needed to write and deploy highly scalable and highly available Java applications. Under your dedicated “application space” the platform components run to ensure your application is able to respond to user’s requests, but isolating your application code from the infrastructure and all the complexity usually associated with complex, distributed deployments.

Let’s jump into OpenShift!

Continue reading

VMware Cloud Foundry: A Cloud Primer

1         Introduction

It’s cloudy, today. But I’m not speaking about the weather in northern hemisphere autumn. Cloud Computing, two words that cannot be explained with just a sentence, is now a reality, born to change our (digital) lives.

Cloud Computing may mean different things to different people. For some, it would be having their personal documents, photos and music synchronized “in the cloud” and accessible through their PC or mobile device. For others, it would be being able to run their favorite games and to do their favorite stuff anywhere, anytime. It may be a cost-effective, agile hosting solution, an elastic production environment for databases and application servers, and many, many other things. Google Docs, Picasa, iCloud, Facebook, Twitter, Foursquare, Amazon EC2…

In this article, though, we will be discussing about Cloud Computing as a platform where developers can deploy their highly scalable, highly available solutions. We call this Platform-as-a-Service, or PaaS for short. PaaS also means a lot of things but for us is forgetting about dealing with the OS, the application server, the disc or the memory in the server. You just have your “application space”, where you can upload your solutions, execute them, monitor how they behave and control the amount of resources available to them.

You don’t know where your application physically is, the type of host server, operating system configuration or even how the application server is configured at all. You may certainly know about some or all of this, but it is really not needed to achieve your targets: develop your idea and make it available to your clients (no matter how much or where they are) in a hassle.

VMware Cloud Foundry is one of such platforms.

Continue reading

Measure Code Coverage of HtmlUnit Based Tests with Sonar and JaCoCo

This blog post is the third one in a series about Integration Tests with HtmlUnit. The first post, titled “Automating Assembly and Integration Tests with HtmlUnit”, showed how to write integration tests of web UI applications using HtmlUnit. That post can be read here. The second post, titled “Integrate HtmlUnit Based Tests with Apache Maven and Cargo”, showed how to automate the execution of HtmlUnit tests using Maven and Cargo plug-in. That post can be read here.

Finally, in this post we are going to show how to measure code coverage of HtmlUnit tests using Sonar, the popular Continuous Quality Assurance tool, and JaCoCo, a very interesting code coverage tool based on JVM agents instead of instrumenting bytecodes.

Continue reading