Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Unit Test in AEM

Avatar

Level 5

I want to add unit test in my project since I use AEM cloud manager pipeline to trigger build. During which there is a step to check unit test. I'm not sure which framework would be good to go ahead with. [MOCKITO, SPOCK, JUNIT, ProsperSpec, anything else that is latest, etc]

Please guide.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

You can start from here https://github.com/arunpatidar02/com.aemlab.junitapp 

I have created few simple junit test cases, this could be a starting point.

View solution in original post

3 Replies

Avatar

Community Advisor

Hi @Shaheena_Sheikh,

According to official Adobe documentation, and Adobe best practices below should be used for unit testing:

We will be using AEM best practices, and use:

This Adobe documentation also describes step by step how to setup this on project level.

Avatar

Level 7

Please refer this document for details of framework used for writing Unit test.

 

https://experienceleague.adobe.com/docs/experience-manager-learn/getting-started-wknd-tutorial-devel...

 

You can create a new sample project with latest archetype to get few Unit tests already created for reference. Please refer this document which has command for Cloud project setup :

 

https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/archetyp...

 

SS from above link:

sachinarora_0-1658137176878.png

 

Avatar

Correct answer by
Community Advisor

You can start from here https://github.com/arunpatidar02/com.aemlab.junitapp 

I have created few simple junit test cases, this could be a starting point.