Integrate your Selenium Testing with Octopus Deploy

Let's go over an example of how you can integrate your Selenium tests with Octopus Deploy. Below is a diagram showing a typical CI/CD pipeline setup using TeamCity and Octopus Deploy. The deployment process includes a step that triggers a Selenium test via the Nugridium API. We created an Octopus step template that will useful for this scenario.

Continuous Integration pipeline

Octopus step template for triggering a Selenium test run

We have created an Octopus step template that you can use in your deployment process in order to easily trigger test runs against your deployment environments.

Continuous Integration pipeline

The above step template gives you fields for the Nugridium server url, your credentials, a test run configuration id, a test environment id and a list of browsers to test with. The Browsers field format should be BrowserType_BrowserVersion where BrowserType is any of the following values: Chrome, Firefox or IE (case sensitive) and BrowserVersion is any version number that is available on the agent(s) and which is configured via the Server Manager. The BrowserVersion can also be "0", which will use any version that is installed on the agent.

Since it will be polling the Nugridium server for the test run results, there is a field that allows you to specify a timeout for this operation (so that your Octopus tentacle can exit in case the test run doesn't complete in a reasonable time).

You can download our custom Octopus Deploy step template. Or view the template's text here

You can also use this PowerShell (slimmed down) script for testing your connectivity from a PowerShell CLI outside of Octopus (replace the variable values with your own). This test script will allow you to trigger an existing test run configuration against an existing test environment.

Include Selenium test binaries in your Octopus deployment

The above step template can optionally upload your Selenium test binaries if they are part of your deployment process (if you use the 'Octopus Step Name' field).

You can set up your pipeline with two Git repositories for example. One repository for the website to test and another repository for your Selenium test binaries. As the website is being developed, new test methods are being added to the Selenium tests project. With the pipeline shown in the following diagram you can automatically handle the running of any new test methods during your website's deployments.

Continuous Integration pipeline

The following image shows an Octopus process with three steps. The third step uses our custom step template which is able to retrieve the Selenium test binaries from the default deployment location and push them to the Nugridium server. It triggers a test run and starts polling for the test run to complete.

Continuous Integration pipeline

After completion the custom step template uploads an html file to the Octopus build as an artifact containing the test run results.

The test results html artifact will always be available right on the Octopus deployment detail page:

Continuous Integration pipeline

A sample artifact's contents are shown below:

Continuous Integration pipeline

Watch video on using NuGridium in a CI/CD pipeline