Unit Test in AEM | Community
Skip to main content
Level 6
July 18, 2022
Solved

Unit Test in AEM

  • July 18, 2022
  • 3 replies
  • 1221 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by arunpatidar

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.

3 replies

lukasz-m
Community Advisor
Community Advisor
July 18, 2022

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.

Sachin_Arora_
Community Advisor
Community Advisor
July 18, 2022

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-develop/project-archetype/unit-testing.html?lang=en

 

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/archetype/using.html?lang=en

 

SS from above link:

 

arunpatidar
Community Advisor
arunpatidarCommunity AdvisorAccepted solution
Community Advisor
July 18, 2022

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.

Arun Patidar