Codebay Innovation
CodeBay Coding Others

Automatic front-end testing in AEM environments

Testing is an essential part of the development and provides an extra layer of quality for any AEM project.

This focuses on the development of FrontEnd tests that allow the developer to confirm that any changes applied to the software do not affect any of the previously developed code.

To achieve this goal, a series of topics will be discussed clarifying how the development of these tests should be organized.

Expectations for the automatic tests
The goal is to execute a set of automatic tests that verify different scenarios representing real use cases for the developed web page.

Test class proposed
The automatic test world is very big, and it includes a huge series of test approaches. This article wants to dedicate a few words to talk about the application of automatic regression test. This kind of tests makes sure that the development of a new functionality does not affect or break the correct functioning of the previous developed code.

Reasons for using automatic test
Besides regression errors that a developer can add into the code by mistake, there is also the risk for a QA person (external to the development team) to test the functionality from different perspectives than those used by the developers, and ending to find a series of unseen errors in the planned workflow.

To address these issues and verify a higher number of scenarios without involving a big QA team, the use of automatic tests fit perfectly the scope.

The ideal situation is to automate a series of tests (starting form well-defined use cases) that simulate one or more workflows covering any potential use of the web pages by the final user.

Choosing the right tools
The tool choice depends by the depth level of the tests and their context. Considering the simple use case of an overall check of the correct functioning of the web pages, it is recommended to use the extensions for the browsers such as Selenium IDE or Katalon Recorder that allow the developers and QA team to create quickly and easily specific tests to prove the new features or corrections in the code.

To obtain a high number of test results or a deeper interaction with the web pages, it is possible to develop tests with Katalon Studio or Selenium that allow to manage runtimes/delays or even implement comprehensive reports that show all the test results using tables, graphs, screenshots, and more.

Best Practices
It is necessary to be clear about the following concepts:

  • The tests must be presented as use cases. For example:
    Starting from a test idea, the QA team creates a description of the use case from the end user perspective. then, the different test cases can be created and organized in a “Test Suite”. The test suite is executed by one of the automatic tools.
    The “Test Cases” contain the routines or instructions to perform the specific test for each identified use case.visual concept sketch for testing
  • Ideally, it should be possible to separate the “data” that will dynamically feed the routines from the “Test Cases”.
  • Therefore, the routines should be as generic as possible to allow for the full range of data.
  • The ideal situation is to work with a modularity approach.
  • If a use case is very complex/long, it is better to try to split it up to control in more details the potential failures.
  • Do not make abuse of the use of pauses/waits in the routines.
  • Simulate the natural behavior of a user, trying to avoid the “in the background” with the DOM and without forgetting that in many cases these tests must be executed as fast as possible, maybe remotely or even without a GUI environment.
  • Selectors/identifiers that are less prone to changes during software maintenance should be used.
  • The data should have a structure/normalization that allows for variety/updating/scalability.
  • Separate common data from TC-specific data. Example: Separate the URL data from the stream data so that the same json connection can be used for several different TCs.
  • as soon as a new error is found or new functionality is developed, a test case must be added to the current list.
  • In an ideal scenario, the QA team should not have the same people who developed the code.

In summary, although testing may be considered less fun than coding, it is an important quality and security step that provides greater peace of mind and responsiveness to all the steps of the development, so it is always a safe bet to use in any project, especially if subsequent maintenance is planned.

Powerful automatic tools like Katalon and Selenium make the quality control team’s life much simpler and they are not hard to implement, at least on a basic level. CodeBay Innovation, since 2019, applies automatic test for all the new web projects and for the daily support, improving its quality standards.

Do you need help for you AEM projects?

You Might Also Like

No Comments

    Leave a Reply