I have built my new AEM project using the latest AEM Project Archetype 20, and I have some questions about the integration tests; more so, AEM 6.3, AEM 6.4, AEM 6.5.
After building the AEM Project, I see it.launcher and it.test module. As instructions are stated in the parent README.md, running mvn clean verify -PintegrationTests would do the trick successfully; The launchpad will be surfaced; the integration test passes.
While I am trying to insert new code for making tests for my sling model, workflows, osgi services, listeners, etc... it is very difficult for me to debug my tests as I am getting errors in my intelliJ. There is no documentation at all for me to understand how to get started with the out of the box it.launcher and it.test module setup. Reviewing the sample it.test setup, the code is very confusing. The context HelloWorldModelServerSideTest.java makes no sense where all of a sudden we are creating a new object "AdminResolverCallable" within the tests. Searching on Google, "AdminResolverCallable" does not exist at all. Where are the documentation that explains which helper classes/framework we can utilize?
As I try to debug my code (using intelliJ debugging tools), I am consistently getting errors like SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder" and java.lang.NoClassDefFoundError: org/osgi/framework/BundleActivator; including breakpoints is definitely not working for me. I feel like adding custom code changes to the it.test module is daunting, hard to understand, and have no documentation for us developers to understand how to get started with integration tests on AEM.
[concerning]While looking at the latest AEM core components (https://github.com/adobe/aem-core-wcm-components), even that project itself has no examples of how integration tests are run; maybe it's so difficult to set up that they just removed it.
Trying to work with it.launcher and it.test module is so difficult, here is my question. Can we use https://wcm.io/ to write integration tests? Unit tests are working well with the WCM.IO framework already.
The WCM.IO framework includes:
Access to mocked OSGi, mocked JCR and mocked Sling environment provided by the Apache Sling project
If this is not the best practice, can we please have better documentation for the integration sample piece for the AEM Archetype project? The internet has no information on how to properly run inteegration tests for AEM.