|Door:||Harm Pauw & Robert van Vark, 04-03-2015|
|Onderwerp:||Continuous delivery CD CI Tooling Testing|
This blog post is the second one in the series of “UI tests with Selenium and more”. This post will be about Selenium Grid, how it’s often used to test with multiple browsers and the challenges you face with supporting infrastructure.
In the previous blog we discussed Selenium WebDriver, why people often use it in combination with HtmlUnit instead of real browsers, and why it is not that smart to use HtmlUnit only. In case you’ve forgotten: none of your real customers actually uses HtmlUnit, as it doesn’t have a GUI. Also, it is not possible to take screenshots since there’s no rendered page to capture.
The main reason for teams to use HtmlUnit is that it can run easily on your headless build server. Also, it would be very time-consuming to manually create individual suites of automated tests for every OS / browser combination that your customers use. Fortunately, Selenium provides a framework of doing exactly that: Selenium Grid. With Selenium Grid, you can set up a grid of multiple browsers and OS combinations that you can use in your tests. What makes it better is that your tests can be completely browser and OS agnostic. This enables you to use the same test suite to test multiple browser and OS combinations.
Selenium Grid’s architecture consists of several Nodes and one central Hub. A Node can provide one or more browsers, e.g. Chrome and Internet Explorer, on a specific operating system. The Grid is controlled from a central place called the Hub.
Running your automated tests only requires that you create a RemoteWebdriver object, provide it with your wishes regarding the browser and OS and point it to the URL of the Hub. The Hub takes care of distributing your tests to a node that satisfies the browser/OS combination you requested. You can also specify the number of concurrent browser instances on each node, so that you can run your tests in parallel. There’s also a web based Console that - although it’s a little bit primitive - allows you to see the status of each node.
If you only want to test using one particular browser, it’s not necessary to have a separate Hub and Node. In this case, you can start a Standalone server which acts like both a Hub and Node. You can use it in exactly the same way as a grid with a hub and multiple nodes.
You’ll need some infrastructure to create a grid: either in the form of physical servers or virtual machines running on a server on-premise or in the cloud. The setup and maintenance of this grid costs effort and money, even if it’s only used for short periods. For this reason, companies often let multiple applications use the same grid: that way the grid is used more efficiently.
However, sharing a grid with multiple applications also has some downsides. Often the usage of a grid is not evenly distributed so during “rush hours” you can have a queue of tests that wait until they can be executed. This could lead to long execution times and false positives due to timeouts. Also, if the tests of one application are taking a long time to run or even hang (caused by timeouts or other problems), they could seriously affect tests from other applications.
An ideal solution for these problems is to have a completely new and fresh grid every time you start a new test run. This way, test runs for different applications don’t interfere with each other and when a test run goes bad, subsequent test runs are not affected by it. But booting physical and even virtual machines takes up quite some time, so this is not very practical.
In the next blog post we’ll take a look at Docker and see how we can apply this tool to provision on-demand Selenium Grids while avoiding long startup times and other problems.
|Door:||Prajeesh Prathap, 01-01-2015|
|Onderwerp:||Continuous delivery TFS agile git CI|
project. Once you have chosen the version control for your project you can easily hookup a build definition and create CI builds using the hosted build controller provided as part of VS online.
configured for setting up a CI build. Read more..