Author: bdelacretaz
Date: Mon May 27 12:18:42 2013
New Revision: 1486591
URL: http://svn.apache.org/r1486591
Log:
Add Mockito which we seem to be increasingly using
Modified:
sling/site/trunk/content/documentation/tutorials-how-tos/testing-sling-based-applications.mdtext
Modified:
sling/site/trunk/content/documentation/tutorials-how-tos/testing-sling-based-applications.mdtext
URL:
http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/tutorials-how-tos/testing-sling-based-applications.mdtext?rev=1486591&r1=1486590&r2=1486591&view=diff
==============================================================================
---
sling/site/trunk/content/documentation/tutorials-how-tos/testing-sling-based-applications.mdtext
(original)
+++
sling/site/trunk/content/documentation/tutorials-how-tos/testing-sling-based-applications.mdtext
Mon May 27 12:18:42 2013
@@ -26,7 +26,7 @@ The next step is to use mock classes and
We have a number of custom-written mock services in Sling, like
[MockNodeType](https://svn.apache.org/repos/asf/sling/trunk/bundles/commons/testing/src/main/java/org/apache/sling/commons/testing/jcr/MockNodeType.java)
for example. These handwritten mocks implement just what's needed for their
tests, so they might not be reusable as is.
-In other cases we use [jmock](http://www.jmock.org/) to help create mock
objects without having to write much code - such mocking libraries take care of
the plumbing and allow you to write just the bits of code that matter (often
with funny syntaxes). The tests of the
[org.apache.sling.event](https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/event/)
bundle, for example, make extensive use of such mock services.
+In other cases we use [jmock](http://www.jmock.org/) or [Mockito][1] to help
create mock objects without having to write much code - such mocking libraries
take care of the plumbing and allow you to write just the bits of code that
matter (often with funny syntaxes). The tests of the
[org.apache.sling.event](https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/event/)
bundle, for example, make extensive use of such mock services.
The problem with mocks is that it can become hard to make sure you're actually
testing something, and not just "mocking mocks". At a certain level of
complexity, it becomes quicker and clearer to actually start an OSGi framework
for automated tests.
@@ -73,4 +73,7 @@ One problem with these launchpad tests i
## Summary
-Combining the above testing techniques has worked well for us in creating and
testing Sling. Being able to test things at different levels of integration has
proved an efficient way to get good test coverage without having to write too
much boring test code.
\ No newline at end of file
+Combining the above testing techniques has worked well for us in creating and
testing Sling. Being able to test things at different levels of integration has
proved an efficient way to get good test coverage without having to write too
much boring test code.
+
+
+ [1]: https://code.google.com/p/mockito/
\ No newline at end of file