# -*- coding: utf-8 -*- # $Id: wuitestresult.py 62484 2016-07-22 18:35:33Z vboxsync $ """ Test Manager WUI - Test Results. """ __copyright__ = \ """ Copyright (C) 2012-2016 Oracle Corporation This file is part of VirtualBox Open Source Edition (OSE), as available from http://www.virtualbox.org. This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation, in version 2 as it comes in the "COPYING" file of the VirtualBox OSE distribution. VirtualBox OSE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. The contents of this file may alternatively be used under the terms of the Common Development and Distribution License Version 1.0 (CDDL) only, as it comes in the "COPYING.CDDL" file of the VirtualBox OSE distribution, in which case the provisions of the CDDL are applicable instead of those of the GPL. You may elect to license modified versions of this file under the terms and conditions of either the GPL or the CDDL or both. """ __version__ = "$Revision: 62484 $" # Python imports. import datetime; # Validation Kit imports. from testmanager.webui.wuicontentbase import WuiContentBase, WuiListContentBase, WuiHtmlBase, WuiTmLink, WuiLinkBase, \ WuiSvnLink, WuiSvnLinkWithTooltip, WuiBuildLogLink, WuiRawHtml, \ WuiHtmlKeeper; from testmanager.webui.wuimain import WuiMain; from testmanager.webui.wuihlpform import WuiHlpForm; from testmanager.webui.wuiadminfailurereason import WuiFailureReasonAddLink, WuiFailureReasonDetailsLink; from testmanager.webui.wuitestresultfailure import WuiTestResultFailureDetailsLink; from testmanager.core.failurereason import FailureReasonData, FailureReasonLogic; from testmanager.core.report import ReportGraphModel, ReportModelBase; from testmanager.core.testbox import TestBoxData; from testmanager.core.testcase import TestCaseData; from testmanager.core.testset import TestSetData; from testmanager.core.testgroup import TestGroupData; from testmanager.core.testresultfailures import TestResultFailureData; from testmanager.core.build import BuildData; from testmanager.core import db; from testmanager import config; from common import webutils, utils; class WuiTestSetLink(WuiTmLink): """ Test set link. """ def __init__(self, idTestSet, sName = WuiContentBase.ksShortDetailsLink, fBracketed = False): WuiTmLink.__init__(self, sName, WuiMain.ksScriptName, { WuiMain.ksParamAction: WuiMain.ksActionTestResultDetails, TestSetData.ksParam_idTestSet: idTestSet, }, fBracketed = fBracketed); self.idTestSet = idTestSet; class WuiTestResult(WuiContentBase): """Display test case result""" def __init__(self, fnDPrint = None, oDisp = None): WuiContentBase.__init__(self, fnDPrint = fnDPrint, oDisp = oDisp); # Cyclic import hacks. from testmanager.webui.wuiadmin import WuiAdmin; self.oWuiAdmin = WuiAdmin; def _toHtml(self, oObject): """Translate some object to HTML.""" if isinstance(oObject, WuiHtmlBase): return oObject.toHtml(); if db.isDbTimestamp(oObject): return webutils.escapeElem(self.formatTsShort(oObject)); if db.isDbInterval(oObject): return webutils.escapeElem(self.formatIntervalShort(oObject)); if utils.isString(oObject): return webutils.escapeElem(oObject); return webutils.escapeElem(str(oObject)); def _htmlTable(self, aoTableContent): """Generate HTML code for table""" sHtml = u'
%s | \n' \ u'||||
%s | \n' \ % (self._toHtml(aoRow[0]),); else: sHtml += u'%s | \n' % (webutils.escapeElem(aoRow[0]),); if len(aoRow) > 2: sHtml += u'%s | \n' % (aoRow[2](aoRow[1]),); else: sHtml += u'%s | \n' % (self._toHtml(aoRow[1]),); sHtml += u'
---|
When | \n' \ '\n' \ ' | Elapsed | \n' \ 'Event name | \n' \ 'Value (status) | ' \ '\n' \ ' |
---|
\n%s\n | \n' % '\n';
sHtml += self._generateMainReason(oTestResultTree, oTestSet);
sHtml += ' Events:\n'; sHtml += ' \n'; sHtml += ' | \n';
sHtml += '