Skip to content

dsf openshift services selenium basic grid

travis edited this page Jul 1, 2019 · 7 revisions

Basic Selenium Grid setup in OpenShift

[Under construction]


The purpose of the present document is to provide the basic steps carried out to setup a Selenium Grid (Hub + Nodes) in OpenShift.

Introduction

Selenium is a tool to automate web browser across many platforms. It allows the automation of the testing in many different browsers, operating systems, programing laguages, or testing frameworks. (for further information pelase see Selenium)

Selenium Grid is the platform provided by Selenium in order to perform the execution of tests in parallel and in a distributed way.

It basically consists on a Selenium Server (also known as hub or simply server) which redirects the requests it receives to the appropriate node (Firefox node, Chrome node, …​) depending on how the Selenium WebDriver is configured or implemented (See Selenium Doc.)

Prerequisites

  • OpenShift up & running

Procedure

The present procedure is divided into two different main parts: * First part: Selenium Hub (server) installation * Second part: Selenium node installation (Firefox & Chrome) * Create persistent volumes for the hub and the node(s)

Selenium Hub installation

The followed approach consists on deploying new image from the OpenShift WenConsole.

The image as well as its documentation and details can be found at Selenium Hub Docker Image

Step 1: Deploy Image

step1

Step 2: Image Name

As it is specified in the documentation (selenium/hub)

(Please notice that, as it is described in the additional documentation of the above links, the server will run by default on 4444 port)

step2

Step 3: Introduce the appropriate resource name

(selenium-hub in this case)

(No additional config. is required by the moment)

step3a

Once the image is deployed, you will be able to check & review the config. of the container. Please notice by, by default, no route is created for external traffic, hence the application (the selenium server or hub) is not reachable from outside the cluster

step3b

Step 4: Create a route for external traffic

step4

Step 5: Change the default config. if necessary

step5

DONE !!

The Selenium Server is now accesible from outside the cluster. Click on the link of the route and you will be able to see the server home page.

done1

console/view config to see the default server config.

Please notice that the server is not detecting any node up & running, since we have not yet installed none of them.

done2

Selenium Node Firefox installation

(Same steps apply for Selenium Node Chrome with the selenium/node-chrome Docker image)

The key point of the nodes installation is to specify the host name and port of the hub. If this step is not correctly done, the container will be setup but the application will not run.

The followed approach consists on deploying new image from the OpenShift WenConsole.

The image as well as its documentation and details can be found at Selenium Hub Docker Image (firefox node in this case)

Step 1: Deploy Image

Introduce the appropriate Docker Imgage name as it is specified in the documentation (selenium/node-firefox)

step1

Step 2: Introduce the appropriate resource name

(selenium-node-firefox in this case)

step2

Step 3: Introduce, as environment variables, the host name and port of the selenium hub previously created

Env. var. for selenium hub host name

  • Name: HUB_PORT_4444_TCP_ADDR

  • Value: The Selenium hub host name. It’s recommended to use the service name of the internal OpenShift service.

Env. var. for host selenium hub host port

  • Name: HUB_PORT_4444_TCP_PORT

  • Value: 4444 (by default), or the appropriate one if it was changed during the installation.

step3

DONE !!

If the creation of the contianer was correct, we will be able to see our new selenium-node-firefox application up & running, as well as we will be able to see that the firefox node has correctly detected the selenium hub (in the log of the POD)

done1
done2

If we go back to the configuration of the SeleniumHub thourgh the WebConsole, we also will be able to see the our new firefox node

done3

Persisten Volumes

Last part of the installation of the Selenium Grid consists on creating persisten volumes for both, the hub container and the node container.

Persisten Volumes can be easely created folling the the BitBucket Extra server configuration

Clone this wiki locally