Hi Team,
We are moving from AMS to AEMaaCS and re-designing and implementing the components. Can anyone help us with documentation on which JUnit is recommended and also quick turn-around time to meet to 80% coverage?
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Hi @SrikanthPo3
Knowing how much is the turn-around time to meet again 80% code coverage depends on how much from previous solution you will reuse and how much has changed. You will need to make an assessment based on what you know about your implementation.
As I understand is not only about migration from AMS to AEMaaCS, but also about doing changes to the original implementation of the components, doing re-designs (which I assume you are not referring to only visual things, but also in terms of component structure & behavior). This can represent a challenge in estimating how much time could get you to have back min 80%.
Now, speaking purely technical on migrating the unit tests, this is a very good article:
This is for how to use usw Junit 5 with Mockito and wcm.io
In case you have AEM integrations with external services, which you may need to mock in order to run your tests, you can consider using MockServer:
For AEMaaCS, JUnit 5 is recommended for testing due to its enhanced features over JUnit 4.
To achieve 80% test coverage quickly:
- Use Mockito for mocking AEM services and dependencies.
- Write unit tests for business logic and integration tests for AEM interactions.
- Use JaCoCo or SonarQube to track coverage.
- Leverage CI/CD tools like Jenkins to run tests automatically.
This approach should help you efficiently reach your coverage goals.
Recommendation is to use https://wcm.io/ . It simulates the AEM's API behavior, rather than mocking it.
Turn around time would depend how vast and complex your application is. It would be difficult for us to suggest.
Hi @SrikanthPo3 ,
We should use the wcm.io AEM Mocks library, which provides essential tools for mocking AEM's APIs. The key classes and frameworks for unit testing in AEM include:
AemContext (wcm.io AEM Mocks) – Sets up a mock AEM environment, allowing simulation of resources, requests, and responses.
AemContextExtension (JUnit 5) – Integrates AemContext into JUnit 5 test cases efficiently.
AemContext JUnit Rule (JUnit 4) – Used for JUnit 4 to manage test context setup and teardown.
Regards,
Hi @SrikanthPo3
Knowing how much is the turn-around time to meet again 80% code coverage depends on how much from previous solution you will reuse and how much has changed. You will need to make an assessment based on what you know about your implementation.
As I understand is not only about migration from AMS to AEMaaCS, but also about doing changes to the original implementation of the components, doing re-designs (which I assume you are not referring to only visual things, but also in terms of component structure & behavior). This can represent a challenge in estimating how much time could get you to have back min 80%.
Now, speaking purely technical on migrating the unit tests, this is a very good article:
This is for how to use usw Junit 5 with Mockito and wcm.io
In case you have AEM integrations with external services, which you may need to mock in order to run your tests, you can consider using MockServer:
@SrikanthPo3 Did you find the suggestions helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!
Views
Likes
Replies