I’ve recently started using OpenShift and thought I’d write about my findings on how to use OpenShift with Selenium.
For those of you who do not know what OpenShift does, the excerpt from OpenShift’s website says
OpenShift is Red Hat’s Platform-as-a-Service (PaaS) that allows developers to quickly develop, host, and scale applications in a cloud environment
Where OpenShift shines, is its ability to take docker containers, and deploy them in any configuration you could imagine.
The way this post pertains to Selenium, is the fact that you are able to leverage OpenShift, and the existent Selenium Docker containers, to create a scalable Selenium infrastructure.
Defines the parameters in which the Selenium Grid will run
A Chrome specific configuration to enable replication controllers in OpenShift which allow free-scaling of a Selenium Node with the Chrome browser, and the ability to connect to any hub.
A Firefox specific configuration to enable replication controllers in OpenShift which allow free-scaling of a Selenium Node with the Firefox browser, and the ability to connect to any hub.
This tutorial will show you step-by-step instructions on getting your infrastructure in place using one hub, and one Chrome node connecting to the hub.
- Download the OpenShift Templates by cloning, or downloading directly.
- Login to your OpenShift instance using the
- Create the Selenium Hub template by using
oc create -f selenium-hub.yaml
- Create the Selenium Node Chrome template by using
oc create -f selenium-node-chrome.yaml
- From the OpenShift WebApp, switch to your desired project, and click “Add to Project”
- Search for “selenium” and add the “selenium-hub” template to the project.
- Click Create
- Click “Add to Project”
- Search for “selenium” and add the “selenium-node-chrome” template to the project.
- Upon configuration of the Selenium Node, change the HUB_PORT_4444_TCP_ADDR and HUB_PORT_4444_TCP_PORT to the route defined here.
- Click Create
You now have a scalable infrastructure with one hub, and any amount of nodes ready to run tests in the Chrome browser. Add to this as necessary. You may also
oc create -f selenium-node-chrome.yaml and follow steps 8-11 in the context of “firefox” instead of chrome.