DynaTrace Ajax Edition is a free tool for optimizing web 2.0 applications. It supports Microsoft Internet Explorer as well as Mozilla Firefox. Dynatrace finds problems and provides a complete picture of what is going on in the browser and it automatically recommend optimizations. This recipe will show how dynaTrace can capture the network traffic from the activity generated by your testing tool.
We have to download and install dynaTrace AJAX Edition from http://ajax.dynatrace.com/, before we can start measuring our websites performance.
- We have to set an environment variable to the Selenium process that launches the browser, before we can capture a performance metrics. We can do this in eclipse by opening the context menu on the project and select Run As > Run Configurations…
Click on the TestNG test class in the left panel, then click on the environment tab in the right panel. In this tab we can add our environment variables that will launch with the TestNG test, by clicking New…
- Start the installed dynaTrace AJAX edition application.
- Run the Selenium tests.
- The results are visible in dynaTrace AJAX edition, after finishing the tests.
You have to start dynaTrace AJAX Edition before running your test. The Browser that you launch via Selenium will not start the AJAX Edition Client but will just try to connect to an existing instance.
What has been done
Selenium starts a browser with the predefined environment variables and will pass all performance related metric through dynaTrace AJAX Edition. Testresults can be analyzed in dynaTrace AJAX Edition after finishing the testscripts.
There is more…
Allow thirdparty add-ons
We might not see any results in dynaTrace AJAX edition due Microsoft Internet Explorer security restrictions. In this case we need to modify the browser settings using the following actions.
- Open Microsoft Internet Explorer
- Go to the manage add-ons window by clicking Tools > Internet Options and select Programs > Manage add-ons
- Enable the dynaTrace AJAX edition Toolbar and Agent, by selecting the add-on and click on Enable
We can set more environment variables to the Selenium process. We can implement the environment variables in the tables below on the same way as described above.
|DT_AE_AGENTACTIVE||True will activates the browser add-on Agent.|
|DT_AE_AGENTNAME||Name of the recorded session.|
|DT_AE_SERVER||(optional) Allows you to connect to a dynaTrace AJAX Client on a different port (only localhost connections are allowed). Default: localhost:9988|
|DT_AE_CLEARCACHE||(optional) Allows you to clear the browser cache before browsing through your sites. Default: false|
|DT_AE_STARTURL||(optional) Allows you to specify an initial Start Url. Default: about:blank|
We might want to know which environment variables are set for debugging purposes. We can download Microsoft Process Explorer from the following location: http://technet.microsoft.com/en-us/sysinternals/bb896653
We can check the browser process (iexplorer.exe or firefox.exe) and check which environment variables get passed. In the screenshot below we can see the environment variables that get passed by dynaTrace AJAX Edition Client to the browser when launching a browser from the Client.