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

Register test run through restAPIs

sbhat
Guide

We are using Jenkins for our tests which executes JMeter scripts.

Currently, we have added following dynatrace header in our JMeter scripts, NA=pTest-${__P(JOB_NAME)}.${__P(BUILD_NUMBER)}.${__samplerName()};TR=${__P(DT_TESTRUN_ID)};SN=${__P(JOB_NAME)}.${__P(BUILD_NUMBER)}.${__samplerName()}

Due to these headers, even local JMeter execution results in Tests being registered and populating the "Test Results" tab.

Is there a way to register tests as an option where only valid tests are registered via REST APIs and the rest are discarded?


3 REPLIES 3

joao_vilacia2
Inactive

Hi @Shruthi B.

This configuration is available in Jmeter BeanShell PreProcessor, you can identify origin of the execution and add conditional to add or remove headers;

You can create variables to identify the local environment and the jenkins environment;

http://jmeter.apache.org/usermanual/component_refe...

I Hope have helped!.

Best,

João Vilacia.


sbhat
Guide

Hi @João V.

The preProcessor will be required for each Http request. We have tests with multiple transactions and each transaction might have 1-20 http requests. Is there a way to add a sampler and push it to each HTTP request header?

Thanks,

Shruthi


sbhat
Guide

Due to TR=${__P(DT_TESTRUN_ID)}, the value of TR gets set to 1 if no DT_TESTRUN_ID is available.

The server log shows following entry

2019-04-16 21:50:21 UTC INFO [TestRunHandler] TestRun '1' not found or uuid is not valid - using current TestRun 'ee10a62a-381f-4a13-87fd-0b35cced229d'

I tried to set TR=${DT_TESTRUN_ID} where the variable value is blank if DT_TESTRUN_ID is available.

The HTTP header shows

X-dynaTrace: NA=pTest-DT_Test.1.ilp-login-mgr+ || /services/logon;TR=;SN=DT_Test.1.ilp-login-mgr+ || /services/logon

But the log shows

2019-04-17 01:20:48 UTC INFO [TestRunHandler] TestRun '${DT_TESTRUN_ID}' not found or uuid is not valid - using current TestRun '03a4bfa8-0ba9-4607-abcb-25066c8276e6' [log message will be suppressed for 10 minutes]

Where do these test Run Ids get auto-generated?