Test automation for AEM sites applications

Automating tests helps in ensuring the integrity of the implementation over the changes in the codebase. It saves cost and laborious efforts of regression in long run avoiding repetitive test activities increasing the reliability of the application. Automating tests is the way to achieve continuous testing.

Unit tests

Unit testing increases confidence in the code when it undergoes changes. However, there is an upfront cost attached to writing the unit tests. Business critical logic, code which are susceptible to change and re-usable code are potential candidates for unit testing. Design objects ensuring easy test-ability. Unit tests are tied to language in which the code is written. There is wide choices available for every language. Junit is popular for Java. Karma, jasmine, Qunit are few of the popular unit testing library for Java script.

Integration tests

Integration tests achieve testing the custom code with platform layers such as apache felix OSGi container, Granite, Sling or JCR. Depending on the scenarios, the decision has to be made to use mocks or real APIs. Usage of mock is easier but overusing it might affect the validity of the test.

  • Popular mocking frameworks – Mockito, PowerMock.
  • Sling and OSGi based mocking libraries – SlingContext, OSGiContext.

Real tests – Sling supports server side junit tests. This needs a live AEM instance.

Functional tests

Functional tests validate scenarios. Adobe recommends using hobbes.js to write functional tests for components. Depending on the skillset availability there are options such as Selenium, Watin, etc for testing the whole page. Functional tests have to address the authoring aspects of aem components and the end- user interface for different screen width adaptations such as desktop, mobile, etc.

Hobbes.js – https://helpx.adobe.com/in/experience-manager/6-3/sites/developing/using/hobbes.html

Regression test

Regression suite made of unit tests, integration tests, functional tests help save manual regression efforts. In addition to them, visual regression testing tools such as PhantomCSS can also be used to test the GUI.

Leave a Reply

Your email address will not be published. Required fields are marked *