NOTICE: Our Community is moving. Get more information.
This blog describes how you can trigger executions from your CI server using a Gradle script. Further it describes how to get results from Silk Central and how to use them in your build process.
You can download the silkcentral.gradle file from the Tools section in Silk Central during the build process or add it to your source control system.
The script can be configured using project properties. You can either pass the properties when triggering the script or you can specify the properties in the script.
Here is a sample for launching the script from the command line:gradle -b silkcentral.gradle :silkCentralLaunch -Psc_executionNodeIds='22431,22432,22433' -Psc_host='http://localhost:19120' -Psc_token='80827e02-cfda-4d2d-b0aa-2d5205eb6ea9'
All additional project properties, specified when launching the script, will be passed as parameters to Silk Central and are used for the execution. This enables you to parameterize the executions in Silk Central with values from the build server.
e.g.: If your build starts a test server in Docker, you can pass the URL to this server by specifying the property in the command line
If the property sc_collectResults is set to true, the script will wait till all triggered executions on Silk Central have finished and will generate JUnit.xml files out of the results. The files will be stored in the subfolder sc_results.
If your build process is not already using Gradle, you have to ensure Jenkins can execute Gradle scripts.
Install Gradle in Jenkins under Manage Jenkins -> Global Tool Configuration.
In your project, add a build step "Invoke Gradle script".
Depending on where you have stored the script, you need to adapt the Build File property. Configure the step like in the following example:
As shown in the example, you can also use variables available in Jenkins, like $BUILD_NUMBER, to configure the script.
If your Jenkins project is parameterized, you can pass all parameters directly to Silk Central by selecting "Pass all job parameters as Project properties".
To show test results in Jenkins, add a post-build action "Publish JUnit test result report". Specify the location the script writes the files to in the Test report XMLs field.
The integration with TeamCity is similar.
To process the test results from Silk Central, you have to add the Build Feature "XML report processing" and configure it like: