Index: /main/waeup.sirp/trunk/src/waeup/sirp/testing.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/testing.py	(revision 6462)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/testing.py	(revision 6463)
@@ -9,5 +9,5 @@
 import waeup.sirp
 from zope.app.testing.functional import (
-    ZCMLLayer, FunctionalTestSetup, getRootFolder, sync)
+    ZCMLLayer, FunctionalTestSetup, getRootFolder, sync, FunctionalTestCase)
 from zope.component import getGlobalSiteManager
 from zope.security.testing import addCheckerPublic
@@ -179,4 +179,28 @@
         cleanUpZope(None)
 
+#: This extended :class:`doctest.OutputChecker` allows the following
+#: additional matches when looking for output diffs:
+#:
+#: `N.NNN seconds`
+#:    matches strings like ``12.123 seconds``
+#:
+#: `HTTPError:`
+#:    matches ``httperror_seek_wrapper:``. This string is output by some
+#:    virtual browsers you might use in functional browser tests to signal
+#:    HTTP error state.
+#:
+#: `1034h`
+#:    is ignored. This sequence of control chars is output by some
+#:    (buggy) testrunners at beginning of output.
+#:
+#: `<10-DIGITS>`
+#:    matches a sequence of 10 digits. Useful when checking accesscode
+#:    numbers if you don't know the exact (random) code.
+#:
+#: `<YYYY-MM-DD HH:MM:SS>`
+#:    matches any date and time like `2011-05-01 12:01:32`.
+#:
+#: `<DATE-AND-TIME>`
+#:    same like ``<YYYY-MM-DD HH:MM:SS>`` but shorter.
 checker = renormalizing.RENormalizing([
     # Relevant normalizers from zope.testing.testrunner.tests:
@@ -185,5 +209,8 @@
     # http://reinout.vanrees.org/weblog/2009/07/16/invisible-test-diff.html:
     (re.compile(r'.*1034h'), ''),
-    (re.compile(r'httperror_seek_wrapper:'), 'HTTPError:' )
+    (re.compile(r'httperror_seek_wrapper:'), 'HTTPError:' ),
+    (re.compile('[\d]{10}'), '<10-DIGITS>'),
+    (re.compile('\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d'), '<YYYY-MM-DD HH:MM:SS>'),
+    (re.compile('\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d'), '<DATE-AND-TIME>'),
     ])
 
@@ -211,2 +238,32 @@
     test.layer = FunctionalLayer
     return test
+
+optionflags = (
+    doctest.REPORT_NDIFF + doctest.ELLIPSIS + doctest.NORMALIZE_WHITESPACE)
+
+class FunctionalTestCase(FunctionalTestCase):
+    """A test case that supports checking output diffs in doctest style.
+    """
+
+    def assertMatches(self, want, got, checker=checker,
+                      optionflags=optionflags):
+        """Assert that the multiline string `want` matches `got`.
+
+        In `want` you can use shortcuts like ``...`` as in regular doctests.
+
+        If no special `checker` is passed, we use an extended
+        :class:`doctest.OutputChecker` as defined in
+        :mod:`waeup.sirp.testing`.
+
+        If optional `optionflags` are not given, use ``REPORT_NDIFF``,
+        ``ELLIPSIS``, and ``NORMALIZE_WHITESPACE``.
+
+        .. seealso:: :data:`waeup.sirp.optionflags`
+
+        .. seealso:: :data:`waeup.sirp.checker`
+        """
+        if checker.check_output(want, got, optionflags):
+            return
+        diff = checker.output_difference(
+            doctest.Example('', want), got, optionflags)
+        self.fail(diff)
