Expand my Community achievements bar.

AEM Forms unit testing

Avatar

Level 3

Hello Guys,

 

I am looking for a recommended way/framework for Unit Testing AEM Adpative Forms. Any recommendation with resources will be helpful.

 

Thanks

 

7 Replies

Avatar

Employee Advisor

@vidhyabhushanbahl 

I don't think we have a framework for unit testing specifically, but you can create test cases within AEM for Adaptive Forms using Calvin SDK built on top of the hobbes.js framework.

More information here- https://experienceleague.adobe.com/docs/experience-manager-learn/forms/adaptive-forms/calvin-sdk-tes... 

Avatar

Level 3

Thanks Pulkit,

 

Calvin in built on hobbes.js which deprecated in 6.5 onwards. BTW, I am looking for unit testing on AEM Forms on Cloud service.

Avatar

Level 2

As pointed out earlier, the current 6.5 documentation indicates the hobbes.js is deprecated.  The page that referenced Calvin.js has been removed from the 6.5 documentation.

 

The page I linked to above recommends using Selenium for UI testing.

Avatar

Level 2

Yes, but the other things are for testing Java code, not UI testing.

 

Don't get me wrong, they are valid for certain types of Adaptive Form development and unit testing (specifically custom component development), but we're just pointing out that Hobbes.js and Calvin.js are not really viable as they will no longer be maintained going forward.

 

The Adobe documentation points to Selenium for UI testing however this is a little disingenuous as Selenium is very low level compared to Calvin.  It will take a lot more work to automate using Selenium and is more brittle to any changes to the HTML that AEM generates for an Adaptive Form.  Overall, it's a less than ideal solution.

 

I view this as a hole in the Adobe Adaptive Form story.

 

Avatar

Employee Advisor

@vidhyabhushanbahl use Junit similar to AEM, nothing fancy here. If you use Out of a box component then the UI testing can be done using Hobes. Model, servlet, data submission, conf can be mock with junit

 

 

https://experienceleague.adobe.com/docs/experience-manager-learn/forms/adaptive-forms/calvin-sdk-tes...

 

https://www.vogella.com/tutorials/Mockito/article.html

 

sample test

 

https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/test/java/com/adobe/cq/w...

 

sample impl test 

 

https://wcm.io/testing/aem-mock/usage.html