April 6, 2020
Estimated Post Reading Time ~

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 the 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 Javascript.

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.



By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.