Set up and run your Cucumber and Selenium web tests on Gitlab-CI within minutes
Build great software faster! CI/CD is hot and is still gaining interest. Test Automation is obviously essential within any Continuous Integration setup in order to get test feedback often and fast. Within the test automation groups here at spriteCloud we have seen a lot of different setups. We have been integrating test automation into CI tools such as Jenkins, TeamCity, Travis, TFS, Circle CI, Bamboo and Gitlab. Out of all the solutions we are a big fan of Gitlab, especially since it is making the integration of test automation a breeze.
.gitlab.yml config file for your Selenium tests
So without further ado, let’s give you the complete code you need to run your tests within a Gitlab CI:

Wait, what? I only need a configuration file? That’s it? Yes!
There are some prerequisites of course:
- Have the Gitlab runner executor set to ‘docker’ (for this example)
- use your selenium_remote_url environment variable within your test scripts. The selenium chrome service we started is accessible through: http://selenium__standalone-chrome:4444/wd/hub/
Let’s make the CI setup a bit more efficient though by adding some caching:

Configure your Selenium remote URL
The last thing to keep in mind is to include the selenium_remote_url in the test scripts. Here at spriteCloud we are using our open-source gem lapis-lazuli in order to quickly setup Ruby, Cucumber and Selenium test automation suites. This is how you integrate the URL within such a test suite:

But of course you can use selenium-webdriver directly as well if you want:

Want to try this out yourself in Gitlab? We have setup an example Gitlab project where you can see it in action! Gitlab Cucumber Selenium CI test setup Enjoy!
Further reading:
If you want to get started with test automation using ruby and cucumber you can read Getting started with test automation: Cucumber with Lapis Lazuli.
Thanks for reading. If you enjoyed what you just read and/or found it useful, let us know by clicking the 👏 below!
Originally published at www.spritecloud.com.