Hi, This would be a great addition. I frequently spend hours building mockito based mocks to do the same and although the first time it was fun, it gets a real pain the n'th time. Although you can do the same with a real OSGi Unit test and an in memory version of Jackrabbit, the runtime of each unit test often adds to much to the overall build time.
I am +1 on this if it came to a vote. Are there any areas where these Mocks wont work ? Multiple threads, observation, locks, versioning ? Best Regards Ian On 10 October 2014 09:10, Stefan Seifert <[email protected]> wrote: > 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 >
