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.
Solved! Go to Solution.
Views
Replies
Total Likes
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.
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:
- JUnit 5
- Mockito Testing Framework
- wcm.io Test Framework (which builds on Apache Sling Mocks)
This Adobe documentation also describes step by step how to setup this on project level.
Please refer this document for details of framework used for writing Unit test.
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 :
SS from above link:
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.