Giter VIP home page Giter VIP logo

testgrid-plugin's Introduction

Testgrid for Selenium tests Jenkins Plugin

Because developers and teams have better things to do with their time.

Introduction

This Jenkins Plugin provides an easy way to create an on-demand Selenium Grid that you can use in your build. After the build is complete, the Grid is automatically stopped and removed. It uses Docker for the provisioning of the Grid.

Of course there are other Jenkins plugins that you can use to call Docker. The difference is that this plugin specifically uses Docker to create an environment for Selenium and that you don't need to configure yourself.

Build it yourself

If you want to build and package the plugin yourself, just run

mvn package

This will compile the code, run the unit tests and package the plugin to target/testgrid.hpi.

Prerequisites

In order to use the plugin, you'll need to have the following things installed:

  • Jenkins
  • Docker

This plugin uses the command line client instead of the Java implementation. The reason for this is that the Java version can only use a TCP connection to communicate with the Docker server, which can have some security issues. The command line client uses a UNIX socket for communication ad therefore has a different security model. Perhaps in the future, the TCP implementation is also added to the plugin.

In order for Jenkins to call Docker, it needs access to the UNIX socket. The easiest way to do this is to add the jenkins user (or whatever user your Jenkins service uses) to the docker group. Don't forget to restart Jenkins or use newgrp in order to refresh permissions.

There are a couple of pre-made Docker images on Docker Hub that you can use. These are

Basically, every image that runs Selenium Standalone and exposes port 4444 is suitable. In fact, we encourage you to create (and share) your own images. You can look at the Docker build file to get some inspiration. Use docker pull to download the images that you want to use.

Installation

Installation is easy, just install the plugin using the Plugin Manager in Jenkins like any other plugin.

Global configuration

Before you can use the plugin in your jobs, you have to do some global configuration once.

  • Open Global Configuration of Jenkins (Manager Jenkins -> Configure System) and scroll to the section "Test grid for Selenium tests"
  • Fill in the Docker Image to use for Hub. This image is used when you configure multiple browser nodes.
  • Add the browser images that you'd like to use. You have to give it a name and the name of the Docker image. You can optionally use a tag in this image field as well (eg. prowareness/selenium-node-ff:latest).
  • Test your Docker setup using the Test Docker Setup button. This will try to invoke the Docker client.

Job configuration

After you configured the plugin, you can configure your Jenkins job.

  • Open the Job Configuration of a job.
  • In the section "Build Environment", you'll find a checkbox "Test grid for Selenium tests". Check this checkbox. A label "Browser Nodes" with a button "Add" will appear.
  • Add all browser nodes needed by clicking the "Add" button and selecting the browser image (configured in the global configuration).

During a build, an environment variable named TESTGRID_URL will be created. You can pass this environment variable to your test suite so it can use it in its RemoteWebDriver object. For example, when you have a Maven project, you can pass this environment variable in "Goals and options" like test -Dremotewebdriverurl=$TESTGRID_URL. In your code, you can access it using System.getProperty("remotewebdriverurl").

  • Save your configuration.

** By http://prowareness.nl **

testgrid-plugin's People

Contributors

harmpauw avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.