Name and Version
Test Automation Plugin for Jenkins
dynaTrace 5.x, dynaTrace 6
|Source Code||https://github.com/jenkinsci/dynatrace-plugin/ and https://wiki.jenkins-ci.org/display/JENKINS/Dynatrace+Plugin|
Install the plugin through the Jenkins interface: Manage Jenkins -> Manage Plugins -> Available -> Search for "Dynatrace" in the list and install.
The Jenkins plugin pulls Test Automation data from the dynaTrace Server and displays it through charts and tables on the project and build level. In order to do this, it is designed as a "Post-Build Action" and has to know
- how to connect to the dynaTrace Server, and
- how to identify which tests where executed in a build.
In order to do this, we have two prerequisites that have be fulfilled:
On the dynaTrace Server, a dashboard that contains the Test Automation dashlet has be created. This dashboard will be queried through the REST interface from the Jenkins server, so the dynaTrace Server REST interface has to be accessible from the machine running Jenkins.
- In the build that is executed, the DtSetTestInformation call to the dynaTrace Server has set the BUILD_ID provided by Jenkins as the build number. This field is used to identify which tests were executed in a build.
To set it up, you can add the "dynaTrace Test Automation" action as a post-build action to your build:
Here you can enter the connection details as well as the name of the dashboard containing the Test Automation dashlet, and you can test the connection.
In the advanced settings, you have the following options:
- You can change if the build result from the dynaTrace Server should also affect the Jenkins build result - if this is enabled, tests that are considered as volatile or failed (from a functional or performance perspective) by dynaTrace will cause the Jenkins build to be unstable or fail. By default, this feature is enabled
- Depending on the dynaTrace Server load and the volume of tests, it might take a while until the test results are available through the REST interface. By default, the Jenkins plugin will try to get data 6 times, 10 seconds apart. If necessary, you can increase the number of tries here. Please keep in mind that this increases the build duration.
dynaTrace Test Information
The Jenkins plugin uses the BUILD_ID field as a means to identify which tests where executed in a test. Consequently, your build script has to use this BUILD_ID as the buildNumber for the DtSetTestInformation call, and of course has to execute its tests with a dynaTrace Agent being injected. This can be done in several ways:
We import environment variables as properties and use it then to tag the build:
For a Maven build, you can call the appropriate goal directly from the build configuration ("Goals and options" field):