Icon

Comments have been closed on this page. Please use AppMon & UEM Plugins forum for questions about this plugin.

Overview

Name

Automation Library for Dynatrace to integrate Dynatrace in an automated environment such as a build or automated test environment

Description

Automation is key in different phases of the Software Development Lifecycle. Builds are automated by using build-servers that also execute all unit and integration tests to ensure the basic quality criteria for a build before it gets deployed to the next stage. Functional as well as load-tests can be automated to test applications that come out of the build-environment to ensure full functionality, performance and scalability.DynaTrace provides this Automation Library to easily integrate DynaTrace in your Continuous Integration or Test Automation Environment such as Ant, Maven, Jenkins, ....The automation library provides contextual information such as the version/revision/build number to be used by the Dynatrace Automation Test Center and visible in the Test Automation Dashlet. The library also includes reporting capabilities.

Version

1.0

Dynatrace Versions

5.x, 6.x

Author

dynaTrace software

License

dynaTrace BSD

Support

 Supported

Download for Java

Dynatrace AppMon 6.5:

Dynatrace 6.3:

Dynatrace 6.2:

Dynatrace 6.1:

Download for .NET

dynaTrace 5.x, 6.x

Sample Downloads

Report an Issue

https://github.com/Dynatrace/Dynatrace-Server-REST-Java-SDK/issues
https://github.com/Dynatrace/Dynatrace-Ant-Plugin/issues
https://github.com/Dynatrace/Dynatrace-Maven-Plugin/issues

Icon

For more information on using the Ant and Maven tasks, please see Integrate Dynatrace in Continuous Integration Builds

Description

The automation library enables FULL Automation of Dynatrace by leveraging the REST interfaces of the Dynatrace Server. The automation library includes Ant Tasks, Maven Goals and a console application to execute the following actions on the Dynatrace Server:

  • Start/Stop Session Recording: Returns the actual recorded session name
  • Set Test Information: Sets information about the tested built to be used by Test Automation Center
  • Clear Session: Clears the live session
  • Reanalyze Stored Sessions: triggers business transaction analysis of a stored session
  • Enable/Disable Profile
  • Activate Configuration: Activates a configuration within a system profile
  • Get Agent Information: Either returns the number of connected agents or specific information about a single agent
  • Create Memory/Thread Dumps: Triggers memory or thread dumps for a specific connected agent
  • Restart Server/Collector

If you're looking to automate Dynatrace from the command line, please see the documentation of the Command Line Tool.

Releases from Dynatrace AppMon 6.5 onward

Navigate to appropriate project pages for detailed installation and usage descriptions. Each project also contains examples.

Please report issues in each GitHub project's Issue Tracker.

Server REST SDK: https://github.com/Dynatrace/Dynatrace-Server-REST-Java-SDK (needed only when you want to work with thinly-wrapped Server REST endpoints from your Java code, other plugins are based on that library)

Ant plugin: https://github.com/Dynatrace/Dynatrace-Ant-Plugin

Maven plugin: https://github.com/Dynatrace/Dynatrace-Maven-Plugin

Releases prior to Dynatrace AppMon 6.5

The Download package includes:

dtAutomation_{VERSION}.zip

Automation Library for Dynatrace {VERSION} including implemenation for Ant and Maven.
Also includes a JUnit Runner for Selenium and a separate dtTaskDefs.xml that defines and documents all available Ant-Tasks.

dtAutomationForMaven_{VERSION}.zip

Automation Library packaged to be used with the Maven Plugin Repository (includes description files and correct file structure).

com.dynatrace.diagnostics.automation_{VERSION}.zip

Automation Library for specific Dynatrace version, including implementation for Ant and Maven.

dynaTraceAutomationSample.zip

The package includes a sample build.xml for Ant, pom.xml for Maven and Dashboards and configuration files to be used for the Reporting feature.

Installation

To be used with Ant

For 5.5 and 6.x

  • Extract Automation Library Package to your local file system
  • Under lib/dynatrace you find dtTaskDefs.xml (defines all Ant Task) and com.dynatrace.diagnostics.automation.jar (the actual automation library)
  • Have a look at build.xml in the root directory as a sample on how to call the ant tasks

To be used with Maven

  • Extract dynaTraceForMaven_{VERSION}.zip to your local file system.
  • To install the Dynatrace Maven plugin, execute the following command (for 6.2 release):

  • Define properties for the Dynatrace goals as shown in pom.xml from the sample package
  • Invoke your maven goals, e.g.: mvn dynaTrace:dtAutomation:6.2:startRecording

The Dynatrace maven plugin has the following identification (pluginGroupId:pluginArtifactId:pluginVersion): dynaTrace:dtAutomation:6.2

Usage

With Ant

A full example that includes calling JUnit and Selenium tests can be seen in the Demo Application Package. You can also download the build.xml as shown later in this paragraph which is as part of dtAutomation_6.2.0.1238.zip or the dynaTraceAutomationSample_6.2.0.1238.zip sample package.
Use and import dtTaskDefs.xml in your existing Ant file. This file defines all TaskDefs and global properties that allow you to specify username, password, serverURL, ... Here is the full build.xml file that is part of the download sample package. It includes a sample call to all TaskDefs including documentation of the properties:

With Maven

Icon

The Dynatrace version in the maven package may still say 3.5 even though you downloaded the package for Dynatrace 5.5 or 6.0. This problem is fixed with 6.1 release.

Icon

Download the Step-by-Step Guide on How to use Maven and WebDriver with Dynatrace: MavenWebDriverIntegration.docx

A full example can be seen in the pom.xml as part of the dynaTraceAutomationSample_6.2.0.1238.zip sample package.
Also look at description of the previous Maven Plugin Page that explains how to use the reporting and other maven goals that this plugin provides.

Now we can call the startRecording goal in the following way:

You can inject the Dynatrace agent as part of surefire unit testing in Maven pom.xml with settings similar to this:

For Java Developers

The Automation Library includes the Dynatrace REST Automation SDK (com.dynatrace.diagnostics.automation.rest.sdk) which provides the helper class RESTEndpoint which exposes all important REST Interfaces of the Dynatrace Server.
Here is an example on how to use this helper class:

Javadocs for the RESTEndpoint are available in the following archive: javadoc_RESTEndpoint_6.2.0.1238.zip.

DynatraceReporting

For a detailed description about the usage and samples see the documentation on Ant Task for dynaTrace 3.1 Reporting

 

  1. Anonymous (login to see details)

    "Download the JavaDoc" link does not contain all necessary files. Would someone be able to take a look at this? https://apmcommunity.compuware.com/community/download/attachments/24248929/javadoc_RESTEndpoint.zip?version=1&modificationDate=1333028619043

    1. Anonymous (login to see details)

      I've updated the JavaDoc

  2. Anonymous (login to see details)

    Does this plugin work with Maven version 3?

  3. Anonymous (login to see details)

    Yes, I have tried it and it worked fine with Maven 3.

  4. Anonymous (login to see details)

    I agree with Joe above. For instance the "with Ant task definitions and examples" are only present for version 6.1 but possibly work at least for 6+ ? This is a little confusing why the ant tasks are missing for the others...

  5. Anonymous (login to see details)

    I'm trying to use the console application via the command line in preparation for some work with a customer and the jar file doesn't contain any Console.class file.

    So running

    java -cp com.dynatrace.diagnostics.automation.jar com.dynatrace.diagnostics.automation.Console
    returns a  classNotFound exception.

    I have unzipped all the files above and none contain the class. Any idea?

     

    1. Anonymous (login to see details)

      Hello Florent,

      I think parts of the page referring to the Console commands are outdated. I guess the official command line tool is what you're looking for, please see: Command Line Tool

      Hope that helps!

      Regards,
      Wiktor Bachnik

      1. Anonymous (login to see details)

        Just to confirm my last comment, the com.dynatrace.diagnostics.automation.Console stopped being available since 4.2 dynaTrace release. I'll update this page and add a link to the current command line utility description.

        Regards,
        Wiktor Bachnik

  6. Anonymous (login to see details)

    The RestEndpoint getConfigurations appears to only provide the names of all the available System Profile configurations.
    Is it possible to also determine which one is currently active?

    Thanks! 

  7. Anonymous (login to see details)

    How do we add additional test metadata in the 6.x world?  Looking at the JAR it seems the method is there, but I can't tell if there's some undocumented parameter we can pass into the DtStartTest task to add additional things like committer, branch, whatever

    Rick B

    1. Anonymous (login to see details)

      Found it Test Automation and Ant

      Add a "customproperty" sub-element inside the task call

  8. Anonymous (login to see details)

    Hi,

    I'm researching CI integration for Maven for a client but am not having much luck in importing the dTAutomationForMaven_6.3.0.1305 into Dynatrace. Get the following error: "can not update or remove system Bundle"

    I get the same error when trying to import the dtAutomation_6.3.0.1305 plugin as well. Haven't had much luck in finding suitable KB articles dealing with this.

    Please advise on what might be causing this error.

    Thank you

    Francois

    1. Anonymous (login to see details)

      Hi Francois,

       

      What are you exactly trying to do?

      In order to use our Maven integration plugin, you need to install the library to maven repository and update your pom.xml file to use it. This is described on this page, above the comments. 

       

      Best regards,

      Wiktor

      1. Anonymous (login to see details)

        Hi Wiktor,

         

        Thanks for replying to my question. 

         

        The development team of the Online portal for Vodacom (my client) is trying out CI integration for Dynatrace to see whether this will work for them. I hjave no prior experience with getting this integration in place and definitely have little development experience so I need to research everything.

         

        The client (using TeamCity) has tried setting up the integration but the scripts fail on execution with the following dump:

         

        I understand that we do integrate with CI tools like Maven/ANT/Etc. but don't know the actual steps to get this done. The details exposed in the related KB articles do not make a lot of sense to me (possibly because I'm no developer) but the development teams working with these CI / Build tools would understand them better.

         

        I need to be able to advise the client on what he needs to put in place, I.e.:

         

        - Test Center edition of Dynatrace installed (DONE)

        - System Profile and agent group with "Java Tests" sensor pack placed (and Active and Start Purepaths) (DONE)

        - Maven plugin imported in Dynatrace?

        - Integration into TeamCity done? How?

        - dT Agent code/references included in JUnit script? How?

         

        Please advise

        Thanks

        Francois

      2. Anonymous (login to see details)

        Apologies Wiktor. I didn;t include the dump in my last reply. Please see it here:

         

        [INFO] --- dtAutomation:6.3:startTest (DT_StartTest_UnitTest) @ EjbDeltaNuShopClient --- 

        [DEBUG] Dependency collection stats: {ConflictMarker.analyzeTime=0, ConflictMarker.markTime=0, ConflictMarker.nodeCount=1, ConflictIdSorter.graphTime=0, ConflictIdSorter.topsortTime=0, ConflictIdSorter.conflictIdCount=1, ConflictIdSorter.conflictIdCycleCount=0, ConflictResolver.totalTime=0, ConflictResolver.conflictItemCount=1, DefaultDependencyCollector.collectTime=4, DefaultDependencyCollector.transformTime=0} 

        [DEBUG] dynaTrace:dtAutomation:jar:6.3: 

        [DEBUG]    org.codehaus.plexus:plexus-utils:jar:1.1:runtime 

        [DEBUG] Created new class realm plugin>dynaTrace:dtAutomation:6.3 

        [DEBUG] Importing foreign packages into class realm plugin>dynaTrace:dtAutomation:6.3 

        [DEBUG]   Imported:  < maven.api 

        [DEBUG] Populating class realm plugin>dynaTrace:dtAutomation:6.3 

        [DEBUG]   Included: dynaTrace:dtAutomation:jar:6.3 

        [DEBUG]   Included: org.codehaus.plexus:plexus-utils:jar:1.1 

        [DEBUG] Configuring mojo dynaTrace:dtAutomation:6.3:startTest from plugin realm ClassRealm[plugin>dynaTrace:dtAutomation:6.3, parent: sun.misc.Launcher$AppClassLoader@4e25154f] 

        [DEBUG] Configuring mojo 'dynaTrace:dtAutomation:6.3:startTest' with basic configurator --> 

        [DEBUG]   (f) mavenProject = MavenProject: za.co.vodacom.ejb.client:EjbDeltaNuShopClient:14.0.0-SNAPSHOT @ C:\dev\repos\vod-online-nushop\EjbDeltaNuShopClient\pom.xml 

        [DEBUG]   (s) password = Password1 

        [DEBUG]   (s) profileName = DevelopmentBuilds 

        [DEBUG]   (s) serverUrl = https://ddnt101zadprh.vodacom.corp:8021 

        [DEBUG]   (s) username = Tester1 

        [DEBUG]   (f) versionMajor = 14 

        [DEBUG]   (f) versionMinor = 0 

        [DEBUG]   (f) versionRevision = 0 

        [DEBUG]   (f) versionBuild = 95 

        [DEBUG]   (f) versionMilestone = 0 

        [DEBUG]   (f) category = unit 

        [DEBUG]   (f) agentGroup = Test 

        [DEBUG]   (f) additionalProperties = {} 

        [DEBUG]   (f) ignoreSSLErrors = true 

        [DEBUG] -- end configuration -- 

        [INFO] Using version from pom <version> tag 

        [DEBUG] Build number extracted from pom version is empty, falling back to the value provided in parameters. 

        [INFO] Setting Test Information for system profile: DevelopmentBuilds 

                        version: 14.0.0.95 milestone: SNAPSHOT 

                        category: unit 

        [INFO] Connection to dynaTrace Server via https://ddnt101zadprh.vodacom.corp:8021 with username Tester1, ignoring SSL errors: true 

        [INFO] ------------------------------------------------------------------------ 

        [INFO] Reactor Summary: 

        [INFO] 

        [INFO] EjbDeltaNuShopClient .............................. FAILURE [29.790s] 

        [INFO] EjbDeltaVettingClient ............................. SKIPPED 

        [INFO] WsClientDeltaVetting .............................. SKIPPED 

        [INFO] EjbDeltaNuShop .................................... SKIPPED 

        [INFO] EjbDeltaVetting ................................... SKIPPED 

        [INFO] SysDeltaVetting ................................... SKIPPED 

        [INFO] SysDeltaNuShop .................................... SKIPPED 

        [INFO] RestNuShop ........................................ SKIPPED 

        [INFO] RestVetting ....................................... SKIPPED 

        [INFO] NuShopModuleRestUber .............................. SKIPPED 

        [INFO] PortAngularVetting ................................ SKIPPED 

        [INFO] PortAngularNuShop ................................. SKIPPED 

        [INFO] PortSpringNuShop .................................. SKIPPED 

        [INFO] NuShopModuleWeb ................................... SKIPPED 

        [INFO] NuShopModuleWebUber ............................... SKIPPED 

        [INFO] NuShopPortletBOM .................................. SKIPPED 

        [INFO] NuShopServiceBOM .................................. SKIPPED 

        [INFO] NuShop ............................................ SKIPPED 

        [INFO] ------------------------------------------------------------------------ 

        [INFO] BUILD FAILURE 

        [INFO] ------------------------------------------------------------------------ 

        [INFO] Total time: 30.907s 

        [INFO] Finished at: Tue Jul 26 13:14:57 CAT 2016 

        [INFO] Final Memory: 40M/312M 

        [INFO] ------------------------------------------------------------------------ 

        [ERROR] Failed to execute goal dynaTrace:dtAutomation:6.3:startTest (DT_StartTest_UnitTest) on project EjbDeltaNuShopClient: Execution DT_StartTest_UnitTest of goal dynaTrace:dtAutomation:6.3:startTest failed: Error executing REST request: Unknown problem with Performance Warehouse occured. -> [Help 1] 

        org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal dynaTrace:dtAutomation:6.3:startTest (DT_StartTest_UnitTest) on project EjbDeltaNuShopClient: Execution DT_StartTest_UnitTest of goal dynaTrace:dtAutomation:6.3:startTest failed: Error executing REST request: Unknown problem with Performance Warehouse occured. 

                        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) 

                        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 

                        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 

                        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 

                        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 

                        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 

                        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 

                        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317) 

                        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152) 

                        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555) 

                        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214) 

                        at org.apache.maven.cli.MavenCli.main(MavenCli.java:158) 

                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 

                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 

                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 

                        at java.lang.reflect.Method.invoke(Method.java:497) 

                        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 

                        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 

                        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 

                        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 

        Caused by: org.apache.maven.plugin.PluginExecutionException: Execution DT_StartTest_UnitTest of goal dynaTrace:dtAutomation:6.3:startTest failed: Error executing REST request: Unknown problem with Performance Warehouse occured. 

                        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115) 

                        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) 

                        ... 19 more 

        Caused by: com.dynatrace.diagnostics.automation.rest.sdk.CommandExecutionException: Error executing REST request: Unknown problem with Performance Warehouse occured. 

                        at com.dynatrace.diagnostics.automation.rest.sdk.RESTEndpoint.parseResponse(RESTEndpoint.java:666) 

                        at com.dynatrace.diagnostics.automation.rest.sdk.RESTEndpoint.startTest(RESTEndpoint.java:576) 

                        at com.dynatrace.diagnostics.automation.maven.DtStartTest.execute(DtStartTest.java:84) 

                        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106) 

                        ... 20 more 

        Caused by: com.dynatrace.diagnostics.automation.rest.sdk.RESTErrorException: Unknown problem with Performance Warehouse occured. 

                        at com.dynatrace.diagnostics.automation.rest.sdk.RESTEndpoint.handleHTTPResponseCode(RESTEndpoint.java:479) 

                        at com.dynatrace.diagnostics.automation.rest.sdk.RESTEndpoint.parseResponse(RESTEndpoint.java:659) 

                        ... 23 more 

        [ERROR] 

        [ERROR] 

        [ERROR] For more information about the errors and possible solutions, please read the following articles: 

        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

        1. Anonymous (login to see details)

          Hi Francois,

          So I can see you already have a call to our plugin in your pom.xml, that's good (smile) The error message suggests that Performance Warehouse is not connected, could you please verify in your Dynatrace server settings?

          Currently we don't have a plugin for TeamCity, so you'd need to register the test run in your maven build (I can see you're doing that).

          Once you have the unit tests instrumented in Maven, you should start seeing test data in the Test Results dashlet in your system profile.

           

          Best regards,

          Wiktor