Test automation is not complete without CI – getting it running automatically on a build box. I will show how to get a Selenium test suite running on Jenkins which I have been using personally.
I will assume you have already got Jenkins installed:
1. Click on New Item. Give the item a name and select Freestyle project and you will get to the Configure page
2. Give a Project name
3. Under Source Code Management enter the URL of your code repository. I checkout out the code from Git in the example below.
4. Under Build Triggers, enter the schedule when you like your build to be run, using cron job syntax. The example means the build will run every Monday to Friday on 8.15am.
5. Under Build Environment, check on “Delete work space before build starts” (optional but always safe to do so)
6. Under Build, select the mechanism that you will use to invoke your test. In my case, I use Gradle. (you will need to install this on Jenkins prior under Configure). In the example below, firstly I build the test, then I run the task “cucumber” which will kick off the test. Remember to specify the Root Build script which is the root directory.
7. Finally, in Post-build Actions, specify how you would the result of the build to communicated. In the example below, I use “Publish cucumber results as a report” plugin and Slack Notifications.
8. Click Save and your Jenkins build is ready!
Leave a Reply