5 Steps to Automate Browser Performance Analysis with Watir and dynaTrace AJAX Edition
There are several test automation tools out there that actively drive the browser – like Selenium, Watir, WebAii, QTP, SilkTest, … – Key is to not only to automate test execution but also automate performance analysis. The dynaTrace AJAX Edition enables this by automatically collecting and storing performance data for each browser session. With that integration you can run your automated tests to verify your functionality as well as capturing the data for performance analysis. Here are 5 quick steps to automate test execution and performance analysis with Watir and dynaTrace AJAX Edition.
Step 1: Installation
Step 2: Watir Script Generation
As an example we create a Watir script that opens a new browser, opens the google.com search page and searches for Watir. As a setup step we have to define several environment variables that activate the dynaTrace AJAX Agent in IE. By default – the dynaTrace AJAX Agent is not activated when launching a browser from outside the dynaTrace AJAX Edition Client. With the following environment variables you can control the dynaTrace AJAX Agent:
- DT_IE_AGENT_ACTIVE: true or false to activate or deactivate the agent
- DT_IE_SESSION_NAME: name of the captured performance session. If you have a test run # or test suite name I would use the name here. This is great to identify a captured performance session by its logical name
- (optional) DT_IE_SERVER_HOST: The machine where the dynaTrace AJAX Edition Client runs
- (optional) DT_IE_SERVER_PORT: The port of the dynaTrace AJAX Edition Client
- (optional) DT_IE_CLEAR_CACHE: If true – the dynaTrace AJAX Agent will first clear the browser’s file cache before starting with any execution
Here is the script (Watir Sample Script)that first sets the env-variables and then executes the test steps:
Step 3: Preparing your test machine
Before running a script you have to
- Start the dynaTrace AJAX Edition Client (from the Start Menu -> Programs -> dynaTrace -> dynaTrace AJAX Edition)
- Close all current browsers
Its recommended to have the AJAX Edition Client running on your local machine where you also execute your test scripts. You can however run it on a separate machine. In this case you would need to specify the DT_IE_SERVER_HOST environment variable to the hostname that runs the dynaTrace AJAX Edition Client.