Testing Your UI
- Topics:
- Developing
CREATED FOR:
- Developer
AEM provides a framework for automating tests for your AEM UI. Using the framework, you write and run UI tests directly in a web browser. The framework provides a javascript API for creating tests.
The AEM test framework uses Hobbes.js, a testing library written in Javascript. The Hobbes.js framework was developed for testing AEM as part of the development process. The framework is now available for public use for testing your AEM applications.
Structure of Tests
When using automated tests within AEM, the following terms are important to understand:
Action | An Action is a specific activity on a web page such as clicking a link or a button. |
Test Case | A Test Case is a specific situation that can be made up of one or more Actions. |
Test Suite | A Test Suite is a group of related Test Cases that together test a specific use case. |
Executing Tests
Viewing Test Suites
Open the Testing Console to see the registered Test Suites. The Tests panel contains a list of test suites and their test cases.
Navigate to the Tools console via Global Navigation -> Tools > Operations -> Testing.
When opening the console, the Test Suites are listed to the left along with an option to run all of them sequentially. The space to the right shown with a checkered background, is a placeholder for showing page content as the tests run.
Running a Single Test Suite
Tests Suites can be run individually. When you run a Test Suite, the page changes as the Test Cases and their Actions are executed and the results appear after completion of the test. Icons indicate the results.
A checkmark icon indicates a passed test:
An “X” icon indicates a failed test:
To run a Test Suite:
-
In the Tests panel, click or tap the name of the Test Case that you want to run to expand the deatils of the Actions.
-
Click or tap the Run test button.
-
The placeholder is replaced with page content as the test executes.
-
Review the results of the Test Case by tapping or clicking the description to open the Result panel. Tapping or clicking the name of your Test Case in the Result panel shows all details.
Running Multiple Tests
Test Suites execute sequentially in the order that they appear in the console. You can drill down into a test to see the detailed results.
-
On the Tests panel, tap or click either the Run all tests button or the Run tests button below the title of the Test Suite that you want to run.
-
To view the results of each Test Case, tap or click the title of the Test Case. Tapping or clicking the name of your test in the Result panel shows all details.
Creating and Using a Simple Test Suite
The following procedure steps you through the creation and execution of a Test Suite using We.Retail content, but you can easily modify the test to use a different web page.
For full details about creating your own Test Suites, see the Hobbes.js API documentation.
-
Open CRXDE Lite. (http://localhost:4502/crx/de)
-
Right-click the
/etc/clientlibs
folder and click Create > Create Folder. TypemyTests
for the name and click OK. -
Right-click the
/etc/clientlibs/myTests
folder and click Create > Create Node. Use the following property values and then click OK:- Name:
myFirstTest
- Type:
cq:ClientLibraryFolder
- Name:
-
Add the following properties to the myFirstTest node:
Name Type Value categories
String[]
granite.testing.hobbes.tests
dependencies
String[]
granite.testing.hobbes.testrunner
NOTE
AEM Forms onlyTo test adaptive forms, add the following values to the categories and dependencies. For example:categories:granite.testing.hobbes.tests, granite.testing.hobbes.af.commons
dependencies:granite.testing.hobbes.testrunner, granite.testing.hobbes.af
-
Click Save All.
-
Right-click the
myFirstTest
node and click Create > Create File. Name the filejs.txt
and click OK. -
In the
js.txt
file, enter the following text:#base=. myTestSuite.js
-
Click Save All and then close the
js.txt
file. -
Right-click the
myFirstTest
node and click Create > Create File. Name the filemyTestSuite.js
and click OK. -
Copy the following code to the
myTestSuite.js
file then save the file:new hobs.TestSuite("Experience Content Test Suite", {path:"/etc/clientlibs/myTests/myFirstTest/myTestSuite.js"}) .addTestCase(new hobs.TestCase("Navigate to Experience Content") .navigateTo("/content/we-retail/us/en/experience/arctic-surfing-in-lofoten.html") ) .addTestCase(new hobs.TestCase("Hover Over Topnav") .mouseover("li.visible-xs") ) .addTestCase(new hobs.TestCase("Click Topnav Link") .click("li.active a") );
-
Navigate to the Testing console to try your test suite.
Experience Manager
- Developing User Guide overview
- Introduction for Developers
- Getting Started Developing AEM Sites - WKND Tutorial
- AEM Core Concepts
- Structure of the AEM Touch-Enabled UI
- Concepts of the AEM Touch-Enabled UI
- AEM Development - Guidelines and Best Practices
- Using Client-Side Libraries
- Developing and Page Diff
- Editor Limitations
- The CSRF Protection Framework
- Data Modeling - David Nuescheler’s Model
- Contributing to AEM
- Security
- Reference Materials
- Create a Fully-Featured Website (Classic UI)
- Designs and the Designer (Classic UI)
- Platform
- Sling Cheatsheet
- Using Sling Adapters
- Tag Libraries
- Templates
- Using the Sling Resource Merger in AEM
- Overlays
- Naming Conventions
- Creating a New Granite UI Field Component
- Query Builder
- Tagging
- Customizing Pages shown by the Error Handler
- Custom Node Types
- Adding Fonts for Graphic-Rendering
- Connecting to SQL Databases
- Externalizing URLs
- Creating and Consuming Jobs for Offloading
- Configuring Cookie Usage
- How to programmatically access the AEM JCR
- Integrating Services with the JMX Console
- Developing the Bulk Editor
- Developing Reports
- eCommerce
- Components
- Core Components
- Style System
- Components Overview
- AEM Components - The Basics
- Developing AEM Components
- Developing AEM Components - Code Samples
- JSON Exporter for Content Services
- Enabling JSON Export for a Component
- Image Editor
- Decoration Tag
- Using Hide Conditions
- Configuring Multiple In-Place Editors
- Developer Mode
- Testing Your UI
- Components for Content Fragments
- Obtaining Page Information in JSON Format
- Internationalization
- Classic UI Components
- Headless Experience Management
- Headless and Hybrid with AEM
- Enabling JSON Export for a Component
- Single Page Applications
- SPA Introduction and Walkthrough
- SPA WKND Tutorial
- Getting Started with SPAs in AEM - React
- Getting Started with SPAs in AEM - Angular
- Implementing a React Component for SPA
- SPA Deep Dives
- SPA Editor Overview
- Developing SPAs for AEM
- SPA Blueprint
- SPA Page Component
- Dynamic Model to Component Mapping for SPAs
- SPA Model Routing
- SPA and Adobe Experience Platform Launch Integration
- SPA and Server-Side Rendering
- SPA Reference Materials
- HTTP API
- Content Fragments
- Experience Fragments
- Development Tools
- Development Tools
- AEM Modernization Tools
- Dialog Editor
- Dialog Conversion Tool
- Developing with CRXDE Lite
- Managing Packages Using Maven
- How to Develop AEM Projects Using Eclipse
- How to Build AEM Projects using Apache Maven
- How to Develop AEM Projects using IntelliJ IDEA
- How to use the VLT Tool
- How to use the Proxy Server Tool
- AEM Brackets Extension
- AEM Developer Tools for Eclipse
- AEM Repo Tool
- Personalization
- Extending AEM
- Customizing Page Authoring
- Customizing the Consoles
- Customizing Views of Page Properties
- Configuring your Page for Bulk Editing of Page Properties
- Customizing and Extending Content Fragments
- Extending Workflows
- Extending the Multi Site Manager
- Tracking and Analytics
- Cloud Services
- Creating Custom Extensions
- Forms
- Integrating Services with the JMX Console
- Developing the Bulk Editor
- Extending Classic UI
- Testing
- Best Practices
- Best Practices Overview
- AEM Development Guidelines and Best Practices
- Development Best Practices
- Content Architecture
- Software Architecture
- We.Retail Reference Implementation
- We.Retail Reference Implementation
- Trying out Content Fragments in We.Retail
- Trying out Core Components in We.Retail
- Trying out Editable Templates in We.Retail
- Trying out Responsive Layout in We.Retail
- Trying out the Globalized Site Structure in We.Retail
- Trying out Experience Fragments in We.Retail
- Coding Tips
- Code pitfalls
- OSGI Bundles
- JCR Integration
- Code Samples
- Troubleshooting Slow Queries
- Mobile Web
The Perfect Blend: A New Era of Collaboration with AEM and Workfront
Adobe Customer Success Webinars
Wednesday, Apr 2, 5:00 PM UTC
Explore how Adobe Experience Manager and Workfront integrate to help teams move from ideation to delivery without the usual bottlenecks, ensuring content is organized, on-brand, and ready to go live faster.
RegisterAdobe Experience Manager Sites at Summit
Register for these developer sessions:
- Driving Marketing Agility and Scale: Transforming your Content Supply Chain with AI (attend online)
- How EY Enhanced Regulatory Knowledge Management with Adobe Solutions (attend online)
- Put the Customer at the Center and Build Relationships That Last a Lifetime (attend online)
- Adobe Experience Manager Sites: Top Innovations (attend online)
- B2B Reimagined: Transforming Go-to-Market Strategies for Profitable Growth (attend online)
Connect with Experience League at Summit!
Get front-row access to top sessions, hands-on activities, and networking—wherever you are!
Learn more