<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Doug Ross on Medium]]></title>
        <description><![CDATA[Stories by Doug Ross on Medium]]></description>
        <link>https://medium.com/@sachioross?source=rss-e2e7016c718d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*3iC94uF52KxDWywm.</url>
            <title>Stories by Doug Ross on Medium</title>
            <link>https://medium.com/@sachioross?source=rss-e2e7016c718d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 23:16:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sachioross/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating Regression Test Content Using AEM Content Builder]]></title>
            <link>https://medium.com/adobetech/creating-regression-test-content-using-aem-content-builder-c8222f9356ea?source=rss-e2e7016c718d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c8222f9356ea</guid>
            <category><![CDATA[adobe-experience-manager]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[regression-testing]]></category>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[adobe-experience-cloud]]></category>
            <dc:creator><![CDATA[Doug Ross]]></dc:creator>
            <pubDate>Wed, 18 Nov 2020 00:02:52 GMT</pubDate>
            <atom:updated>2020-11-18T00:02:52.352Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NZwKzrd1nQ4Nh6L3KrTLqw.jpeg" /></figure><p>One of the key challenges facing regression testers is creating a clean-slate of content. In AEM, often small changes with large impacts are made: component properties are updated, dialogs change, the rendering logic is slightly adjusted. In these cases it may be difficult to know if the data the tester is currently seeing is the appropriate data or old data (such as when a component property was changed). To help solve this challenge, some QA teams have created reset-packages that include the expected content; but this is difficult because it:</p><ol><li>This package can quickly become outdated</li><li>Teams often forget to version the packages, so it’s unclear which set of content is being used</li><li>There is no way to tell what will go into AEM without installing it or unzipping the whole package</li><li>Most teams often only have one package and it can be too large for local regression testing or too small for environment-based regression testing</li></ol><p>The <a href="https://www.npmjs.com/package/aem-content-builder">AEM Content Builder</a> was created to facilitate content building needs for various use-cases including migration,demo-builds, and testing. In this article we’re going to focus on how <a href="https://www.npmjs.com/package/aem-content-builder">AEM Content Builder</a> can be used to help facilitate regression testing and make such testing easier for local developers and full QA regressions teams in a dedicated environment.</p><h3>What you need to know</h3><ul><li><a href="https://nodejs.org/en/">NodeJS</a></li><li>Basic knowledge of <a href="https://experienceleague.adobe.com/docs/experience-manager-65/developing/home.html?lang=en#aem-6.5-developing-user-guide">development with AEM</a>, including how to determine resourceTypes and page templates</li><li>Basic understanding of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">Promises</a> and the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API">Fetch API</a></li></ul><h3>Setup: Using the AEM archetype</h3><p>For this discussion we’ll use a new AEM project that we’ll create using the <a href="https://github.com/adobe/aem-project-archetype">AEM Project Archetype</a>. The relevant settings will be listed below if you’d like to follow-along, however this article will not provide an overview of the AEM project itself; readers curious to know more about the AEM project setup can see the <a href="https://docs.adobe.com/content/help/en/experience-manager-learn/cloud-service/local-development-environment-set-up/overview.html">Adobe documentation on the subject</a>.</p><p>For this discussion, the following configuration was used:</p><pre>mvn -B archetype:generate \<br>-D archetypeGroupId=com.adobe.aem \<br>-D archetypeArtifactId=aem-project-archetype \<br>-D archetypeVersion=24 \<br>-D appTitle=&quot;AEM CB&quot; \<br>-D appId=&quot;aemcb&quot; \<br>-D groupId=&quot;com.adobe.samples.aemcb&quot; \<br>-D aemVersion=6.5.0</pre><p>After creating a project with the above, we run the simple command to build our new project (this assumes a running AEM instance on localhost:4502):</p><pre>mvn clean install -PautoInstallPackage</pre><p>This will then give us our simple sample page, such as the one below (note that our sample styling includes light- and dark-mode support, so depending on the time of day the below may appear dark instead).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dnaKD7gZO3HwX4Q59gtypg.png" /></figure><p>And with this, we’re ready to start using the AEM Content Builder to start building!</p><h3>Step one: map components</h3><p>The first order of business is to quickly build out the components. As we’ve used the AEM Project Archetype, the project already has created several project-specific components that proxy the <a href="https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html">Core Components</a>. Similarly, the AEM Content Builder also supplies prototypes of the various core components, and we want to extend those components for our project. For purposes of this article, we’ll extend the following components:</p><ul><li>Container</li><li>Teaser</li><li>Text</li></ul><p>To do this, we’ll extend our components provided by the framework:</p><pre><strong>const</strong> aem = require(&#39;aem-content-builder&#39;);</pre><pre><strong>class</strong> Teaser <strong>extends</strong> aem.components.core.Teaser {<br>  <strong>constructor</strong>() {<br>    <strong>super</strong>();<br>    <strong>this</strong>.setResourceType(&quot;aemcb/components/teaser&quot;);<br>  }<br>}</pre><pre><strong>class</strong> Text <strong>extends</strong> aem.components.core.Text {<br>  <strong>constructor</strong>() {<br>    <strong>super</strong>();<br>    <strong>this</strong>.setResourceType(&quot;aemcb/components/text&quot;);<br>  }<br>}</pre><pre><strong>class</strong> Container <strong>extends</strong> aem.components.core.Container {<br>  <strong>constructor</strong>() {<br>    <strong>super</strong>();<br>    <strong>this</strong>.setResourceType(&quot;aemcb/components/container&quot;);<br>  }<br>}</pre><p>The components are now mapped and ready to use. By extending from the associated core component, there are many utility functions available, such as setTitle for the <strong>Teaser</strong> component and setText for the <strong>Text</strong> component. Additionally, all components have various helper functions, such as setProperty and addChild, which have been made available from the <strong>aem.components.AbstractComponent</strong> object.</p><h3>Step two: map page(s)</h3><p>This example will use a single page class, the <strong>ContentPage. </strong>As with the components above, the <strong>ContentPage</strong> object is created by extending the <strong>aem.components.core.Page</strong> object. For pages, it’s important to set a few key properties: <em>sling:resourceType</em> and <em>cq:template</em>. As these are necessary for all like-pages, it is best to set these properties in the constructor:</p><pre><strong>class</strong> ContentPage <strong>extends</strong> aem.components.core.Page {<br>  <strong>constructor</strong>(title) {<br>    <strong>super</strong>();<br>    <strong>this</strong>.setResourceType(&quot;aemcb/components/page&quot;);<br>    <strong>this</strong>.setTemplate(&quot;/conf/aemcb/settings/wcm/templates/page-content&quot;);<br>    <strong>this</strong>.setContent(&quot;jcr:title&quot;, title ? title : &quot;TITLE MISSING&quot;);<br>  }<br>}</pre><p>It is also important to recall that pages, unlike standard components, store those two properties on their child <em>jcr:content</em> node, so don’t forget to include that prefix in the property if adding manually (such as with a this.props usage). In the above method, the <strong>aem.components.core.Page</strong> object extends the <strong>aem.components.AbstractPage</strong> object. This object provides an overridden setResourceType function that prepends <em>jcr:content</em> to the property and also the setTemplate function to set page templates appropriately.</p><h3>Step three: create pages using functions</h3><p>For brevity, this article will use a simple hierarchy and page structure. Three pages will be created: a <strong>regression-test </strong>landing page which will have to <strong>child</strong> pages. Each page will use our three components (<strong>container</strong>, <strong>text</strong>, <strong>teaser</strong>), but the children will have two teasers that utilize the responsive settings in <a href="https://medium.com/adobetech/understanding-how-to-use-the-aem-grid-c52fb6ea6efb">AEM Grid</a> to sit side-by-side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*92fTRscX4hRHkpSyVd-_9Q.png" /><figcaption>Our page hierarchy</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*_JhUITbLfvUqgG70jC3k1Q.png" /><figcaption>How are pages will be composed</figcaption></figure><p>To clearly delineate when our pages are being assembled, each page will be composed and assembled in their own functions. First the landing page will be assembled:</p><pre><strong>function</strong> createLandingPage(title) {</pre><pre>  // Create our title component; default behaviour is to take the title of the page is no title set<br>  <strong>let</strong> text = <strong>new</strong> Text();<br>  text.setText(&quot;This is our &lt;em&gt;landing page&lt;/em&gt; for our &lt;strong&gt;regression test content&lt;/strong&gt;.&quot;);<br>  text.setIsRich(true);</pre><pre>  // Create the teaser component<br>  <strong>let</strong> teaser_1 = <strong>new</strong> Teaser();<br>  teaser_1.setTitle(&quot;Our Landing Page Teaser&quot;);<br>  teaser_1.setFileReference(&#39;/content/dam/aemcb/asset.jpg&#39;);<br>  <br>  // Create the container component, add the title and teaser components<br>  <strong>let</strong> container_1 = <strong>new</strong> Container();<br>  container_1.addChild(&quot;text&quot;, text);<br>  container_1.addChild(&quot;teaser&quot;, teaser_1);</pre><pre>  // Create the page, add the container and return<br>  <strong>let</strong> page = <strong>new</strong> ContentPage(title);<br>  page.addComponent(&quot;root/container/container/container_1&quot;, container_1);<br>  <br>  <strong>return</strong> page;<br>}</pre><p>Now that the landing page function has been created, we’ll move on to the child page function:</p><pre><strong>function</strong> createChildPage(title) {</pre><pre>  // Create our title component; default behaviour is to take the title of the page is no title set<br>  <strong>let</strong> text = <strong>new</strong> Text();<br>  text.setText(`Welcome to ${title}, one of the child pages!`)<br>  text.setIsRich(true);</pre><pre>  // Create the first teaser component, set to half-width and on the left<br>  <strong>let</strong> teaser_1 = <strong>new</strong> Teaser();<br>  teaser_1.setTitle(&quot;Left Side Teaser&quot;);<br>  teaser_1.setFileReference(&#39;/content/dam/aemcb/asset.jpg&#39;);<br>  teaser_1.setResponsiveSetting({offset: 1, width: 5});</pre><pre>  // Create the second teaser component, set to half-width and on the right<br>  <strong>let</strong> teaser_2 = <strong>new</strong> Teaser();<br>  teaser_2.setTitle(&quot;Right Side Teaser&quot;);<br>  teaser_2.setFileReference(&#39;/content/dam/aemcb/asset.jpg&#39;);<br>  teaser_2.setResponsiveSetting({offset: 0, width: 5});<br> <br>  // Create the container component, add the title and teaser components<br>  <strong>let</strong> container = <strong>new</strong> Container();<br>  container.setLayout(&quot;responsiveGrid&quot;);<br>  container.addChild(&quot;text&quot;, text);<br>  container.addChild(&quot;teaser_left&quot;, teaser_1);<br>  container.addChild(&quot;teaser_right&quot;, teaser_2);</pre><pre>  // Create the page, add the container and return<br>  <strong>let</strong> page = <strong>new</strong> ContentPage(title);<br>  page.addComponent(&quot;root/container/container/container_1&quot;, container);</pre><pre><strong>  return</strong> page;<br>}</pre><p>As can be observed, the creation and configuration only requires the component to be instantiated and configured. If extending from the available core components, most of the associated properties will have utility functions to set the property, such as the <strong>Teaser’s</strong> setFileReference function.</p><p>In the event that a component does not have a function for a specific property setting, or if creating a new component by extending the <strong>aem.components.AbstractComponent </strong>class, then implementations can use the setProperty method to directly set a property key and value.</p><p>Take note in the above that the assembly of a page should occur inside -&gt; out. In other words, components <strong>inside</strong> other components or pages should be created and configured before being added to the outer containing component.</p><h3>Step four: create our structure in AEM using Content Builder</h3><p>With the components and pages mapped and the page creation functions complete, we’re now ready to create our structure and issue the request to AEM:</p><pre><strong>const</strong> host = &quot;http://localhost:4502&quot;;<br><strong>const</strong> root = &quot;/content/aemcb/regression-test&quot;;</pre><pre>aem.request.Handler.getLoginToken(host, &quot;admin&quot;, &quot;admin&quot;)<br>  .then(token <strong>=&gt;</strong> {<br>    <strong>let</strong> pages = createLandingPage(&quot;Regression Test Landing&quot;)<br>      .addChild(&quot;child-1&quot;, createChildPage(&quot;Child One&quot;))<br>      .addChild(&quot;child-2&quot;, createChildPage(&quot;Child Two&quot;));</pre><pre>    // To ensure our content is clean, delete the root of our test content on each run<br>    aem.request.Handler.deletePage(host, root, token)<br>      .then(res <strong>=&gt;</strong> {<br>        <br>        // Create a request to make our new pages<br>        <strong>let</strong> post = <strong>new</strong> aem.request.POST(`${host}${root}`)<br>          .payload(pages.getData())<br>          .setCookie(token);</pre><pre>        // Build the requst and pass to the handler<br>        aem.request.Handler.handle(post.build())<br>          .then(res <strong>=&gt;</strong> { console.log(res); })<br>          .catch(err <strong>=&gt;</strong> console.log(err)) <br>      })<br>      .catch(err <strong>=&gt;</strong> console.log(err))<br>  })<br>  .catch(err <strong>=&gt;</strong> console.log(err))</pre><p>Let’s break down what’s happening:</p><ul><li><strong>aem.request.Handler.getLoginToken </strong>issues a request to AEM’s login URL (/libs/granite/core/content/login.html/j_security_check) and returns the login token cookie, which is used in subsequent requests</li><li>the createLandingPage method returns our landing page object, which then calls the addChild method to specify the relative path to add our child object, which is created in the createChildPage method</li><li>to ensure the test content is fresh each time, the <strong>aem.request.Handler.deletePage </strong>method is executed to delete our target path prior to creating (or recreating) or test content (if no page exists, the method still returns successfully and runs the then)</li><li>We create a <em>mutable</em> request object using <strong>aem.request.POST, </strong>which is later converted to an <em>immutable</em> <a href="https://developer.mozilla.org/en-US/docs/Web/API/Request">Fetch API Request</a> object using the build method</li><li>Similarly, the <a href="https://sling.apache.org/old-stuff/sling-api.html">Sling API</a> expects information as URL Form Data, which is created in the payload function from a JSON object; each component in the framework can expose its data in JSON form using the getData method</li><li>Finally, the <strong>aem.request.Handler.handle</strong> method is called, using the aforementioned build method of the request</li></ul><p>If successful, the response should come back as a 201 Created (as we deleted the page automatically) and the following should be seen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-z1bz6DO2POwvV8WsucI9A.png" /><figcaption>Our Expected Structure</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ibl2fidXCMpAJOvwXTfhxg.png" /><figcaption>Our Regression Landing Page</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_KlPjjAFQx69ZVboJFltUQ.png" /><figcaption>One of our two Child Pages with the teasers side-by-side</figcaption></figure><p>A careful observer might see that there’s another few components included that the script didn’t create: search bar, header, footer, and a title. These components and their associated configuration come from the underlying <a href="https://experienceleague.adobe.com/docs/experience-manager-learn/sites/page-authoring/template-editor-feature-video-use.html?lang=en#page-authoring">editable template</a>.</p><h3>Final Step: Stop manually creating content</h3><p>A proper testing suite provides development and business teams with confidence that changes will not have unforeseen consequences and that business objectives are being met. However, many organizations are reticent or unable to achieve rapid development cycles because the regression testing is, in many cases, manual from the setup to the analysis.</p><p>Tools and systems such as <a href="https://www.selenium.dev/">Selenium</a> can help automate the testing and analysis side; however often customers mention the setup is still difficult to create clean, reusable, controlled content for those tests in a timely manner. This is the area where <a href="https://www.npmjs.com/package/aem-content-builder">AEM Content Builder</a> can help your team reduce costs while greatly increasing confidence in your development efforts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c8222f9356ea" width="1" height="1" alt=""><hr><p><a href="https://medium.com/adobetech/creating-regression-test-content-using-aem-content-builder-c8222f9356ea">Creating Regression Test Content Using AEM Content Builder</a> was originally published in <a href="https://medium.com/adobetech">Adobe Tech Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>