in the last week i've developed at suite of mocking libraries to run OSGi/SCR, JCR and esp. Sling in a simulated "in-memory" environment for unit tests, ensuring minimal setup time. it uses either a mocked in-memory JCR, or the resourceresolver-mock [1] implementation that is already part of the sling project. additional convenience features like bulk-loading JSON content and binaries into the simulated resource tree via a content loader makes it easy setting up complex text fixtures for your unit tests.
the mocking libraries are currently documented at: - http://wcm.io/testing/osgi-mock/ - http://wcm.io/testing/jcr-mock/ - http://wcm.io/testing/sling-mock/ some documentation examples to see how it works: [2], [3], [4] types of resource resolver implementations supported: [5] a short introduction from adaptTo: [6] i would donate this with full unit test coverage and documentation to apache sling and can maintain it in the future. it's already published with apache license 2.0. my proposal would be to place this as additional subprojects below [7] WDYT? stefan [1] https://svn. apache.org/repos/asf/sling/trunk/testing/resourceresolver-mock [2] http://wcm.io/testing/sling-mock/usage-mocks.html [3] http://wcm.io/testing/sling-mock/usage-content-loader.html [4] http://wcm.io/testing/osgi-mock/usage.html [5] http://wcm.io/testing/sling-mock/resource-resolver-types.html [6] http://adapt.to/content/dam/adaptto/production/presentations/2014/adaptTo2014-Lightning-Mock-AEM&Co-for-Unit-Tests-Stefan-Seifert.pdf [7] https://svn.apache.org/repos/asf/sling/trunk/testing
