'Run the test suite against the supplied test class and compare the
XML result against the expected XML string. Fail if the expected
string doesn\'t match the actual string. All time attribute in the
expected string should have the value "0.000". All error and failure
messages are reduced to "Foobar".'

def _try_test_run(self, test_class, expected):

    runner = XMLTestRunner(self._stream)
    runner.run(unittest.makeSuite(test_class))
    got = self._stream.getvalue()
    got = re.sub('time="\\d+\\.\\d+"', 'time="0.000"', got)
    got = re.sub('(?s)<failure    (.*?)>.*?</failure>', '<failure    \\1>Foobar</failure>', got)
    got = re.sub('(?s)<error    (.*?)>.*?</error>', '<error    \\1>Foobar</error>', got)
    self.assertEqual(expected, got)
