Accelerate AEM performance tests

23 February 2017
Lukasz Morawski
Frink_Cognifide_2016_HeaderImages_0117

With every new project comes the need for performance testing. And although each project requires a bespoke approach, there are always elements of the testing procedure that are repetitive. Actually, repetitive is understating it, they can often be tedious and boring. To us, this is just a waste because those very same elements, approached in a different way, could become reusable, rather than repetitive. So, using JMeter, a tool that we use to execute our performance tests, we looked at creating a solution to repeating common tasks across every project. We came up with the JMeter Test Plan Template, especially useful if you are working in Adobe Experience Manager since you will usually be calling on AEM API as part of your test.


If you want to make performance testing with JMeter more efficient, grab our template and test it! First, here's what you'll find: 


JMeter Test Plan Template features

  • Parametrization - re-used, preconfigured user variables.
  • Tuned for AEM - there is a preconfigured thread that activates a page on author to replicate the page via author-publish-dispatcher path. The tread also shows how to authenticate to AEM Author instance and reuse a CSRF token (works for AEM 6.2) to simulate real system usage.
  • Preconfigured loggers - preconfigured simple data writers for .csv, .xml and influx database (for Live monitoring).
  • Other features:
    • Think times with with parametrized Gaussian Random Timer (real user behaviour simulation)
    • Test profiles with user defined variables for different test environments
    • An http request configured to download embedded resources, parallel download and filtering out calls to 3rd party domains
    • Exemplary http requests (GET, POST) and config elements (transaction and throughput controllers).

How to use it

The template is created in JMeter 3.1 with the following set of plug-ins (install Plug-in Manager first):

  • 3 basic graphs
  • 5 additional graphs
  • Distribution/percentile graphs
Once you have downloaded Plug-in Manager, download the template (.jmx file) and put it into the JMeter “\bin\templates\” folder. Then edit “\bin\templates\templates.xml” and add a snippet from \jmeter-aem-templates\templates.xml or paste the following:
<template isTestPlan="true">
        <name>AEM WebApplication Test Plan</name>
        <fileName>aem-template.jmx </fileName>
        <description><![CDATA[
        <h1>AEM WebApplication Test Plan</h1>
        <h2>Overview</h2>
        <ul>
            <li>Parametrization - re-used, preconfigured User Variables</li>        
            <li>Tuned for AEM - preconfigured thread that activates page on author (to replicate page via author-publish-dispatcher path). Thread also presents how to authenticate to AEM Author instance and reuse CSRF token (works for AEM 6.2)</li>
            <li>Preconfigured loggers - preconfigured Simple Data Writers for .csv, .xml and Influx database (for Live monitoring)</li>
            <li>Think times with with parametrized Gaussian Random Timer</li>
            <li>Test Profiles with User Defined Variables for different test environments</li>
            <li>HTTP Request configured for download embedded resources, parallel download and filtering out calls to 3rd parties domains</li>
            <li>Exemplary HTTP Requests (GET, POST) and Config Elements (Transaction and Throughput Controllers)</li>
        </ul> 
        <h2>Useful links</h2>
            <ul>
                   <li><a href="https://github.com/Cognifide/jmeter-aem-templates" >Cognifide Labs GitHub documentation</a></li>
            </ul>
        ]]></description>
</template>
After running JMeter, choose the option “File->Templates” then select from the drop-down “ AEM WebApplication Test Plan” and click the “Create” button. And that's it!

So, next time that you start new performance tests, just take this template and enjoy the fact that some of the basic work has been done for you.  All download details and other references are below and please share your comments, recommendations and improvements.