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.
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.
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. Get best Selenium with C# training here. 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
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.
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.
After completion the custom step template uploads an html file to the Octopus build as an artifact containing the test run results.