We are in the process of integrating dynatrace with our selenium scripts and came to a point where we want to pass the 'DT_TESTRUN_ID' environment variable to the browser running our tests (in order to enable parallel runs). We actually want to do the same with the other variables (DT_AGENTACTIVE, DT_AGENTNAME...) but did not succeed to do this in a scripted way.
We start our selenium scripts from Ant using JUnit - we use the automation library ant tasks to start/stop session recording and start/end test runs (DtStartRecording/DtStopRecording and DtStartTest/DtEndTest respectively).
How should this be done, we tried the following without any luck:
Thanks for your help!
Answer by Solmaz A. ·
I have a problem where I give the Selenium runner an Agent name of "x" and then it sometimes get's mixed with other instances and will be automatically named as x. This will result in a separate metric row in the automation dashlet so the continuous trend of the metric will be lost. As an example I'll have two rows as below:
1.Number of resources for agent name x
2.number of resources for agent name x
I will need these two to be integrated into one. If I use the DT_TESTRUN_ID solution will it fix my problem?
Answer by Jan S. ·
Thanks for the information, we will revisit this with the fall release. Does that mean that we will get into trouble when running two parallel selenium test runs? Will the data get mingled together?
If anyone has an idea on how to set these variables on the process that runs the browser they are very welcome - I did not succeed to achieve that. We are using WebDriver though.
Answer by Andreas G. ·
The environment variables need to be passed to the browser. In order for that to work you need to set them on the process that launches the browser. This is probably not your Ant or JUnit tests - but - it is the Selenium RC which actually executes the scripts and with that also launches the browsers. Environment variables on windows get "inherited" by child processes. So - best is to set these env-variables on that selenium server.
As for DT_TESTRUN_ID. This variable is currently (dT 5.5) only evaluated by Java and .NET Unit Tests. It will not yet work for Browser Agent Tests - this is something we implement in the upcoming versions of dT.