Hi,
I've gone through Sling and AEM Mocks but none of those seem helpful to test our custom java classes which has services defined by us along with resource, jcr nodes, session etc. Sling and AEM mock only test Sling and JCR apis. Is there any way to test normal java classes as well along with it? Normal Junit with mockito and powermockito requires a lot more effort and we don't want to do that.
Any good examples would be helpful.
Thanks!
Solved! Go to Solution.
Views
Replies
Total Likes
Yes. It should be good enough. We've used Mockito for our code coverage.
Test an AEM sling servlet using aem-mocks – AEM Quick Snippets
https://www.practicalaem.com/2016/01/19/testing-using-mockito/
Views
Replies
Total Likes
do you have any examples for it? Ever tried AEMMock?
Views
Replies
Total Likes
See this GEMS webinar - it shows best practice with respect to JUNIT testing with AEM -- From Unit Testing to Integration Test of an AEM Application
Views
Replies
Total Likes
As mentioned by Scott, please go through this GEM session:- AEM Gems 12_14_16 Tools to use for testing AEM applications
~kautuk
Views
Replies
Total Likes
Thank you for replying.
I’ve already gone through this document
But AEM Mocks and AEM Context seem more likely to test content, register OSGI services and AEM components only.
My question was - if we have normal java objects (which belong to different APIs) as well along with Sling and JCR APIs in a Java class do we have to use Mockito along with it, like we do it for normal junits or AEM Mocks would be sufficient?
If we can get some examples it’d be great.
Views
Replies
Total Likes
Yes. It should be good enough. We've used Mockito for our code coverage.
Test an AEM sling servlet using aem-mocks – AEM Quick Snippets
https://www.practicalaem.com/2016/01/19/testing-using-mockito/
Great community content that you referenced here.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies