Chuan Chuan Law

DevOps | Software Automation | Continuous Integration

Tag: CI

Getting Your Tests Into CI – Jenkins

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

newItem

 

2.  Give a Project name

newItem

 

3. Under Source Code Management enter the URL of your code repository. I checkout out the code from Git in the example below.

newItem

 

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.

newItem

 

5. Under Build Environment, check on “Delete work space before build starts” (optional but always safe to do so)

newItem

 

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.

newItem

 

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.

newItem

 

8. Click Save and your Jenkins build is ready!

Integrating Tests Into CI Box

In this example, I am using Cruise Control .NET

  1. Add a project in ccnet.config

The example above do the following:

  • Adds a project in the build that is triggered at 6pm everyday
  • Runs the bat file that runs the tests
  • Copies the output report to be displayed in Dashboard
  • Displays the test report associated with every
  • The “actionName” has to be unique
2. Link the report to Dashboard


 

© 2019 Chuan Chuan Law

Theme by Anders NorenUp ↑