Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dynatrace Appmon Jenkins Plugin - does not show Purepath from App Server


We were trying to use the Dynatrace Jenkins plugin to make use of Test Automation feature.

These are the steps we followed:

1. Installed the plugin in the Jenkins server and entered the Dynatrace configuration details.

2. Installed the Dynatrace agent in the Jenkins build server.

3. Modified the Ant script to have the options as below: [We are running a Selenium Test]

<jvmarg value="-agentpath:C:/Program Files (x86)/dynaTrace/Dynatrace Agent 7.0/agent/lib/dtagent.dll=name=Test,
server=<DT ServerID>:9998,loglevel=warning,optionTestRunIdJava=${dtTestrunID}" />

4. Ran the test from Jenkins.

We had the following issues:

1. We see the test run as 'autogenerated' in Dynatrace AppMon agent, even though we generated a Test Run ID and passed it to the Plugin.

2. We selected the category as uidriven but it was generated as 'unit test' in the AppMon.

3. Looks like the server details shown are from the build server.

4. When we drill down to the PurePath from the Test Case name, it shows the details about the Jenkins Build server and not the App server.

What did we do wrong here? Please shed some light.



Dynatrace Pro
Dynatrace Pro

Hi Devi!

it looks like an issue with the testrunid. Either a problem during the registration of the test run to the AppMon server or a problem while passing the testrunid.

Test run registration: How do you register the test run id? Are you getting a valid testrunid back? You can test if the test run was correctly registered directly in your browser with the API documentation: https://appmonserver:8021/api-docs/current/index.html#!/Test_Automation/getTestrunById

Passing dtTestrunID: Is the test run id really available to the Jenkins server at the moment you are trying to pass it to the java agent? Maybe a debug output would help here


Hi Sonja,

Yes, the test run id is registered and it is being passed as the variable in Jenkins -DdtTestrunID.

The data was populated in Test Automation dashlet once during our testing but it was registered as (augtogenerated). That is when we observed that the PurePaths show the path related to the Jenkins server and not the App server.

In Jenkins log, we do see this error

[testng] 2018-03-12 23:32:56 [000004d4] warning [native] Agent not instrumented properly, license cannot be verified

Also, if we are trying to using uidriven test, should we install the dynatrace agent in the jenkins server? or just injecting the javascript agent would suffice.

when using uidriven test, you get already some data with the JavaScript agent only. It is more interesting if all the server side components are also instrumented by our agents - you get much more data points. BUT be careful, when instrumenting the java agent from Jenkins, you are instrumenting the wrong process (the one triggering the selenium tests, not the server side services being called from the browser)

Dynatrace Pro
Dynatrace Pro

Oh sorry I misread that you are running Selenium tests - in this case discard my previous answer 😉

Have you checked this documentation page? The testrun id should be passed to the JavaScript agent through JavaScript call in your Selenium test - no through the Java Agent. BUT this is an optional step, so maybe you might want to start with the easiest way.

The easiest way would be:

  • disable the test run registration in Jenkins
  • remove the Java agent injection (& testrun information)
  • make sure you define a test name in your selenium test script (sessionStorage.DT_TESTNAME = "myTest";) - see documentation page under the section "Tag the UEM visit as a test"
  • optionally, but recommended end the visit - see documentation page under the section "End the visit before closing the browser (optional)"

The test run registration is required to pass meda data to AppMon (e.g. build number, ...) but it is not required to get data. In this case you will also get an auto-generated test run. Once the easiest way is working for you, you can still extend the integration with the test run id.

Also have a look at the sample project showing the integration:

Thanks for the detailed information Sonja. We will check it out.

The automation test team was also trying to make use of the Dynatrace-Jenkins plugin in their test scripts. In that case, what would be the agent path in the <jvmarg> tag? Would it be the path of the agent in the application server?

<jvmarg value="-agentpath:C:/Program Files (x86)/dynaTrace/Dynatrace Agent 7.0/agent/lib/dtagent.dll=name=Test,<br>server=<DT ServerID>:9998,loglevel=warning,optionTestRunIdJava=${dtTestrunID}" />

Please note that, the Jenkins server does not have components related to the application. I think that's the mistake that we made. We added the Java agent because we got an error, saying it did not find a Java agent, when we triggered the test.

if you are running unit tests from Jenkins, then the process running the tests (in Jenkins) should be instrumented.

but if you are running Selenium tests (even if they are triggered from unit based tests), the process running the tests (in Jenkins) should not be instrumented - you should just make sure that the application being tested is correctly instrumented.

I hope this makes sense 😉

Yes. your explanation helped a lot. Thank you.