How XML Templates Can Help You Load Test

A feature that i have started using more and more of - usually as the testing becomes more advanced or repetitive - is XML templates to configure all tests ahead of time according to a test plan or when running location weighted tests, i.e. X users split over 5 locations and different percentages on total users per location.

XML Templates can make this easier as you are not only able to configure your test ahead of time but you can store these XML:s in a different folder than the test files making the project more manageable.

These XML:s can be either manually written or generated from the configuration you set when you are about to run a test, pressing continue generates the file and you can close the window.

The XML file generated will look something like this:

<?xml version="1.0" encoding="UTF-8"?>
<loadTestTemplate>
  <proxySnifferVersion>V5.4-I</proxySnifferVersion>
  <loadTestProgramPath>/Applications/ZebraTester/5.4-I/MyTests/ZebraTester/APICA_ZebraTester_Rev1.class</loadTestProgramPath>
  <startFromExecAgentName></startFromExecAgentName>
  <startFromClusterName>Stockholm</startFromClusterName>
  <concurrentUsers>20</concurrentUsers>
  <testDuration>300</testDuration>
  <loopsPerUser>0</loopsPerUser>
  <startupDelayPerUser>200</startupDelayPerUser>
  <downlinkBandwidth>0</downlinkBandwidth>
  <uplinkBandwidth>0</uplinkBandwidth>
  <requestTimeout>60</requestTimeout>
  <maxErrorSnapshots>-20</maxErrorSnapshots>
  <statisticSamplingInterval>15</statisticSamplingInterval>
  <percentilePageSamplingPercent>100</percentilePageSamplingPercent>
  <percentileUrlSamplingPercent>20</percentileUrlSamplingPercent>
  <percentileUrlSamplingPercentAddOption>0</percentileUrlSamplingPercentAddOption>
  <debugOptions></debugOptions>
  <additionalOptions></additionalOptions>
  <sslOptions>tls11</sslOptions>
  <pmaTemplateFileName></pmaTemplateFileName>
  <testRunAnnotation></testRunAnnotation>
  <userInputFields/>
</loadTestTemplate>

You can name this to represent either the amount of users or which step in the order to run the tests in preparation of someone else taking over and running them.

To take it to the next step we have the use case where you want to run multiple tests at the same time, from different locations where each location gets 20% of the total users, this can be done by just copying the first file and generating a file for each configuration or reusing the template, these files also don’t need to be in the same folder as .class or .zip files.

Take caution with using this however as you will not be warned about input data having changed and wont get the opportunity to rezip with the updated input file or plugin

Here is an example of how i usually do it:

And if you want to simplify it further you can select all XML files for one multi location test and combine them into one big XML containing configuration options for every location from the original XML:s by clicking the “Zip Selected Files” button.

When clicking the execution button to start the test it will now launch all tests configured in the combined XML,

I hope this helps you prepare before your next load test and if you want to read more you can just click here.