':param test: Qualified name for test case.
Should have next format:
{packagename}.{path.to.class.in.module}.{testcase}.
Examples:
scripts.script-afd.test_afd
core.controllers.auto_update.tests.test_autoupd.TesVMgr.testXXX
:param fail: Failure string
:param took: Time that took the test to run.'

def add_failure(self, test, fail, took):

    self._stats['fail'] += 1
    faillines = fail.split('\n')
    quoteattr = saxutils.quoteattr
    (pkg, _, id) = test.rpartition('.')
    self.results.append(('<testcase    classname=%(pkg)s    name=%(name)s    time="%(took)d"><failure    type=%(errtype)s    message=""><![CDATA[%(fail)s]]></failure></testcase>' % {'name': quoteattr(id), 'pkg': quoteattr(pkg), 'took': took, 'errtype': quoteattr(faillines[(-1)]), 'fail': '\n'.join(faillines[:(-1)])}))
