Page tree
Skip to end of metadata
Go to start of metadata

Last updated: Sep 14, 2017 09:05

By Raj Pasupathy

Jenkins Gradle TestNG job.


Jenkins & Gradle
Refer to the Perfecto community article link on how to setup Gradle & Github. 

1) Gradle Full Setup - CI Automation
2) Github & Maven Setup - CI Automation


Jenkins Setup as a tomCat Service
Refer to the Tips & Tricks article on how to setup Jenkins as a windows Service.

Jenkins Setup
Please ensure to install the Gradle Jenkins plugin before creating a Jenkins job. (see link below). You can install the plugin directly in jenkins > Plugin Manager > Available and type in Gradle. Install the gradle plugin as shown in the below diagram.

Next we will need to update Gradle Installation under “Manage Jenkins” > “Configure System” and under Gradle installation, you will need to enter the exact gradle build file used to build your gradle project as shown below.


Gradle Jenkins Job
Creating a Gradle Jenkins Job. Create a new “Freestyle project” job and click ok as shown in the diagram below.



In the build section, enable Gradle Build and enter the tasks “clean build assemble” as shown below diagram. In addition, select the “Make Gradle executable” and the “From Root Build Script Dir”. 


Running a testNG job in jenkins
Updated the file test section and change the Tasks on the above screen shot to test. This will execute the test method listed below which will run the testngSampleTest.xml script.

test {      
 useTestNG() {       
      useDefaultListeners = true       
      suiteXmlFilesm << new File("src/test/resources/testngSampleTest.xml")