示例#1
0
 def html(self):
     """
    Render those properties as html
    :return:
    """
     return """
     <div class="property"><i>{name}</i><br/>
     <pre>{value}</pre></div>
     """.format(name=tag.text(self.name), value=tag.text(self.value))
示例#2
0
 def html(self):
     """
    Render those properties as html
    :return:
    """
     return """
     <div class="property"><i>{name}</i><br/>
     <pre>{value}</pre></div>
     """.format(name=tag.text(self.name), value=tag.text(self.value))
示例#3
0
    def html(self):
        """
        Render this as html.
        :return:
        """
        classes = list()

        for classname in self.classes:
            classes.append(self.classes[classname].html())

        return """
        <div class="testsuite">
            <h2>Test Suite: {name}</h2>
            <table>
            <tr><th align="left">Duration</th><td align="right">{duration} sec</td></tr>
            <tr><th align="left">Test Cases</th><td align="right">{count}</td></tr>
            <tr><th align="left">Failures</th><td align="right">{fails}</td></tr>
            </table>
            <a name="toc"></a>
            <h2>Results Index</h2>
            {toc}
            <hr size="2"/>
            <h2>Test Results</h2>
            <div class="testclasses">
            {classes}
            </div>
        </div>
        """.format(name=tag.text(self.name),
                   duration=self.duration,
                   toc=self.toc(),
                   classes="".join(classes),
                   count=len(self.all()),
                   fails=len(self.failed()))
示例#4
0
    def html(self):
        """
        Render this as html.
        :return:
        """
        classes = list()

        for classname in self.classes:
            classes.append(self.classes[classname].html())

        return """
        <div class="testsuite">
            <h2>Test Suite: {name}</h2>
            <table>
            <tr><th align="left">Duration</th><td align="right">{duration} sec</td></tr>
            <tr><th align="left">Test Cases</th><td align="right">{count}</td></tr>
            <tr><th align="left">Failures</th><td align="right">{fails}</td></tr>
            </table>
            <a name="toc"></a>
            <h2>Results Index</h2>
            {toc}
            <hr size="2"/>
            <h2>Test Results</h2>
            <div class="testclasses">
            {classes}
            </div>
        </div>
        """.format(name=tag.text(self.name),
                   duration=self.duration,
                   toc=self.toc(),
                   classes="".join(classes),
                   count=len(self.all()),
                   fails=len(self.failed()))
示例#5
0
    def html(self):
        """
        Render this as html.
        :return:
        """
        classes = list()

        package = ""
        if self.package is not None:
            package = "Package: " + self.package + "<br/>"

        for classname in self.classes:
            classes.append(self.classes[classname].html())

        props = ""
        if len(self.properties):
            props += "<table>"
            propnames = sorted(self.properties)
            for prop in propnames:
                props += "<tr><th>{}</th><td>{}</td></tr>".format(
                    prop, self.properties[prop])
            props += "</table>"

        return """
        <div class="testsuite">
            <h2>Test Suite: {name}</h2><a name="{anchor}">
            {package}
            {properties}
            <table>
            <tr><th align="left">Duration</th><td align="right">{duration} sec</td></tr>
            <tr><th align="left">Test Cases</th><td align="right">{count}</td></tr>
            <tr><th align="left">Failures</th><td align="right">{fails}</td></tr>
            </table>
            <a name="toc"></a>
            <h2>Results Index</h2>
            {toc}
            <hr size="2"/>
            <h2>Test Results</h2>
            <div class="testclasses">
            {classes}
            </div>
        </div>
        """.format(name=tag.text(self.name),
                   anchor=self.anchor(),
                   duration=self.duration,
                   toc=self.toc(),
                   package=package,
                   properties=props,
                   classes="".join(classes),
                   count=len(self.all()),
                   fails=len(self.failed()))
示例#6
0
    def html(self):
        """
        Render this test case as HTML
        :return:
        """
        failure = ""
        skipped = None
        stdout = tag.text(self.stdout)
        stderr = tag.text(self.stderr)

        if self.skipped:
            skipped = """
            <hr size="1"/>
            <div class="skipped"><b>Skipped: {msg}</b><br/>
                <pre>{skip}</pre>
            </div>
            """.format(msg=tag.text(self.skipped_msg),
                       skip=tag.text(self.skipped))

        if self.failed():
            failure = """
            <hr size="1"/>
            <div class="failure"><b>Failed: {msg}</b><br/>
                <pre>{fail}</pre>
            </div>
            """.format(msg=tag.text(self.failure_msg),
                       fail=tag.text(self.failure))

        properties = [x.html() for x in self.properties]

        return """
    <a name="{anchor}">
        <div class="testcase">
            <div class="details">
                <span class="testname"><b>{testname}</b></span><br/>
                <span class="testclassname">{testclassname}</span><br/>
                <span class="duration">Time Taken: {duration}s</span>
            </div>
            {skipped}
            {failure}
            <hr size="1"/>
            {properties}
            <div class="stdout"><i>Stdout</i><br/>
                <pre>{stdout}</pre></div>
            <hr size="1"/>
            <div class="stderr"><i>Stderr</i><br/>
                <pre>{stderr}</pre></div>
        </div>
    </a>
        """.format(anchor=self.anchor(),
                   testname=self.name,
                   testclassname=self.testclass.name,
                   duration=self.duration,
                   failure=failure,
                   skipped=skipped,
                   properties="".join(properties),
                   stdout=stdout,
                   stderr=stderr)
示例#7
0
    def html(self):
        """
        Render this test case as HTML
        :return:
        """
        failure = ""
        skipped = None
        stdout = tag.text(self.stdout)
        stderr = tag.text(self.stderr)

        if self.skipped:
            skipped = """
            <hr size="1"/>
            <div class="skipped"><b>Skipped: {msg}</b><br/>
                <pre>{skip}</pre>
            </div>
            """.format(msg=tag.text(self.skipped_msg),
                       skip=tag.text(self.skipped))

        if self.failed():
            failure = """
            <hr size="1"/>
            <div class="failure"><b>Failed: {msg}</b><br/>
                <pre>{fail}</pre>
            </div>
            """.format(msg=tag.text(self.failure_msg),
                       fail=tag.text(self.failure))

        properties = [x.html() for x in self.properties]

        return """
    <a name="{anchor}">
        <div class="testcase">
            <div class="details">
                <span class="testname"><b>{testname}</b></span><br/>
                <span class="testclassname">{testclassname}</span><br/>
                <span class="duration">Time Taken: {duration}s</span>
            </div>
            {skipped}
            {failure}
            <hr size="1"/>
            {properties}
            <div class="stdout"><i>Stdout</i><br/>
                <pre>{stdout}</pre></div>
            <hr size="1"/>
            <div class="stderr"><i>Stderr</i><br/>
                <pre>{stderr}</pre></div>
        </div>
    </a>
        """.format(anchor=self.anchor(),
                   testname=self.name,
                   testclassname=self.testclass.name,
                   duration=self.duration,
                   failure=failure,
                   skipped=skipped,
                   properties="".join(properties),
                   stdout=stdout,
                   stderr=stderr)
示例#8
0
 def toc(self):
     """
     If this report has multiple suite results, make a table of contents listing each suite
     :return:
     """
     if len(self.suites) > 1:
         tochtml = "<ul>"
         for suite in self.suites:
             tochtml += '<li><a href="#{anchor}">{name}</a></li>'.format(
                 anchor=suite.anchor(), name=tag.text(suite.name))
         tochtml += "</ul>"
         return tochtml
     else:
         return ""
示例#9
0
 def toc(self):
     """
     If this report has multiple suite results, make a table of contents listing each suite
     :return:
     """
     if len(self.suites) > 1:
         tochtml = "<ul>"
         for suite in self.suites:
             tochtml += '<li><a href="#{anchor}">{name}</a></li>'.format(
                     anchor=suite.anchor(),
                     name=tag.text(suite.name))
         tochtml += "</ul>"
         return tochtml
     else:
         return ""
示例#10
0
    def html(self):
        """
        Render this test class as html
        :return:
        """
        cases = [x.html() for x in self.cases]

        return """
        <hr size="2"/>
        <a name="{anchor}">
        <div class="testclass">
            <div>Test Class: {name}</div>
            <div class="testcases">
            {cases}
            </div>
        </div>
        </a>
        """.format(anchor=self.anchor(),
                   name=tag.text(self.name),
                   count=len(cases),
                   cases="".join(cases))
示例#11
0
    def html(self):
        """
        Render this test class as html
        :return:
        """
        cases = [x.html() for x in self.cases]

        return """
        <hr size="2"/>
        <a name="{anchor}">
        <div class="testclass">
            <div>Test Class: {name}</div>
            <div class="testcases">
            {cases}
            </div>
        </div>
        </a>
        """.format(anchor=self.anchor(),
                   name=tag.text(self.name),
                   count=len(cases),
                   cases="".join(cases))
示例#12
0
    def html(self):
        """
        Render this as html.
        :return:
        """
        classes = list()

        package = ""
        if self.package is not None:
            package = "Package: " + self.package + "<br/>"

        for classname in self.classes:
            classes.append(self.classes[classname].html())

        errs = ""
        for error in self.errors:
            if not len(errs):
                errs += "<tr><th colspan='2' align='left'>Errors</th></tr>"
            for part in ["type", "message", "text"]:
                if part in error:
                    errs += "<tr><td>{}</td><td><pre>{}</pre></td></tr>".format(
                        part, tag.text(error[part]))

        stdio = ""
        if self.stderr or self.stdout:
            stdio += "<tr><th colspan='2' align='left'>Output</th></tr>"
            if self.stderr:
                stdio += "<tr><td>Stderr</td><td><pre>{}</pre></td></tr>".format(
                    tag.text(self.stderr))
            if self.stdout:
                stdio += "<tr><td>Stdout</td><td><pre>{}</pre></td></tr>".format(
                    tag.text(self.stdout))

        props = ""
        if len(self.properties):
            props += "<table>"
            for prop in self.properties:
                # we dont call the html method, we want these in a table
                props += "<tr><th>{}</th><td>{}</td></tr>".format(
                    tag.text(prop.name), tag.text(prop.value))
            props += "</table>"

        return """
        <div class="testsuite">
            <h2>Test Suite: {name}</h2><a name="{anchor}">
            {package}
            {properties}
            <table>
            <tr><th align="left">Duration</th><td align="right">{duration} sec</td></tr>
            <tr><th align="left">Test Cases</th><td align="right">{count}</td></tr>
            <tr><th align="left">Failures</th><td align="right">{fails}</td></tr>
            {errs}
            {stdio}
            </table>
            <a name="toc"></a>
            <h2>Results Index</h2>
            {toc}
            <hr size="2"/>
            <h2>Test Results</h2>
            <div class="testclasses">
            {classes}
            </div>
        </div>
        """.format(name=tag.text(self.name),
                   anchor=self.anchor(),
                   duration=self.duration,
                   errs=errs,
                   stdio=stdio,
                   toc=self.toc(),
                   package=package,
                   properties=props,
                   classes="".join(classes),
                   count=len(self.all()),
                   fails=len(self.failed()))
示例#13
0
    def toc(self):
        """
        Return a html table of contents
        :return:
        """
        fails = ""
        skips = ""

        if len(self.failed()):
            faillist = list()
            for failure in self.failed():
                faillist.append("""
                    <li>
                        <a href="#{anchor}">{name}</a>
                    </li>
                    """.format(anchor=failure.anchor(),
                               name=tag.text(failure.testclass.name + '.' +
                                             failure.name)))

            fails = """
            <li>Failures
            <ul>{faillist}</ul>
            </li>
            """.format(faillist="".join(faillist))

        if len(self.skipped()):
            skiplist = list()
            for skipped in self.skipped():
                skiplist.append("""
                    <li>
                        <a href="#{anchor}">{name}</a>
                    </li>
                    """.format(anchor=skipped.anchor(),
                               name=tag.text(skipped.testclass.name +
                                             skipped.name)))

            skips = """
            <li>Skipped
            <ul>{skiplist}</ul>
            </li>
            """.format(skiplist="".join(skiplist))

        classlist = list()
        for classname in self.classes:
            testclass = self.classes[classname]

            cases = list()
            for testcase in testclass.cases:
                if "pkcs11" in testcase.name:
                    assert True

                cases.append("""
                    <li>
                        <a href="#{anchor}">{name}</a>
                    </li>
                    """.format(anchor=testcase.anchor(),
                               name=tag.text(testcase.name)))

            classlist.append("""
            <li>
                <a href="#{anchor}">{name}</a>
                <ul>
                {cases}
                </ul>
            </li>
            """.format(anchor=testclass.anchor(),
                       name=testclass.name,
                       cases="".join(cases)))

        return """
        <ul>
            {failed}
            {skips}
            <li>All Test Classes
            <ul>{classlist}</ul>
            </li>
        </ul>
        """.format(failed=fails, skips=skips, classlist="".join(classlist))
示例#14
0
    def toc(self):
        """
        Return a html table of contents
        :return:
        """
        fails = ""
        skips = ""

        if len(self.failed()):
            faillist = list()
            for failure in self.failed():
                faillist.append(
                    """
                    <li>
                        <a href="#{anchor}">{name}</a>
                    </li>
                    """.format(anchor=failure.anchor(),
                               name=tag.text(
                                   failure.testclass.name + failure.name)))

            fails = """
            <li>Failures
            <ul>{faillist}</ul>
            </li>
            """.format(faillist="".join(faillist))

        if len(self.skipped()):
            skiplist = list()
            for skipped in self.skipped():
                skiplist.append(
                    """
                    <li>
                        <a href="#{anchor}">{name}</a>
                    </li>
                    """.format(anchor=skipped.anchor(),
                               name=tag.text(
                                   skipped.testclass.name + skipped.name)))

            skips = """
            <li>Skipped
            <ul>{skiplist}</ul>
            </li>
            """.format(skiplist="".join(skiplist))

        classlist = list()
        for classname in self.classes:
            testclass = self.classes[classname]

            cases = list()
            for testcase in testclass.cases:
                if "pkcs11" in testcase.name:
                    assert True

                cases.append(
                    """
                    <li>
                        <a href="#{anchor}">{name}</a>
                    </li>
                    """.format(anchor=testcase.anchor(),
                               name=tag.text(testcase.name)))

            classlist.append("""
            <li>
                <a href="#{anchor}">{name}</a>
                <ul>
                {cases}
                </ul>
            </li>
            """.format(anchor=testclass.anchor(),
                       name=testclass.name,
                       cases="".join(cases)))

        return """
        <ul>
            {failed}
            {skips}
            <li>All Test Classes
            <ul>{classlist}</ul>
            </li>
        </ul>
        """.format(failed=fails,
                   skips=skips,
                   classlist="".join(classlist))
示例#15
0
    def html(self):
        """
        Render this test case as HTML
        :return:
        """
        failure = ""
        skipped = None
        stdout = tag.text(self.stdout)
        stderr = tag.text(self.stderr)

        if self.skipped:
            skipped = """
            <hr size="1"/>
            <div class="skipped"><b>Skipped: {msg}</b><br/>
                <pre>{skip}</pre>
            </div>
            """.format(msg=tag.text(self.skipped_msg),
                       skip=tag.text(self.skipped))

        if self.failed():
            failure = """
            <hr size="1"/>
            <div class="failure"><b>Failed: {msg}</b><br/>
                <pre>{fail}</pre>
            </div>
            """.format(msg=tag.text(self.failure_msg),
                       fail=tag.text(self.failure))

        properties = [x.html() for x in self.properties]

        return """
    <a name="{anchor}">
        <div class="testcase">
            <div class="details">
                <span class="testname"><b>{testname}</b></span><br/>
                <span class="testclassname"><b>{type} {testclassname}</b></span><br/>
                <span class="requirements">Time Taken: {reqs}</span><br/>
                <span class="duration">Time Taken: {duration}s</span><br/>
            </div>
            {skipped}
            {failure}
            <hr size="1"/>
            {properties}
            <div class="status"><i>Status</i><br/>
                <pre>{status}</pre></div>
            <div class="expected"><i>Expected</i><br/>
                <pre>{expected}</pre></div>
            <div class="actual"><i>Actual</i><br/>
                <pre>{actual}</pre></div>
            <div class="comments"><i>Comments</i><br/>
                <pre>{comments}</pre></div>
        </div>
    </a>
        """.format(anchor=self.anchor(),
                   testname=self.name,
                   testclassname=self.testclass.name,
                   reqs=self.reqs,
                   type=self.type,
                   duration=self.duration,
                   failure=failure,
                   skipped=skipped,
                   properties="".join(properties),
                   stdout=stdout,
                   stderr=stderr,
                   status=self.status,
                   expected=self.expected,
                   actual=self.actual,
                   comments=self.comments)
示例#16
0
    def html(self):
        """
        Render this as html.
        :return:
        """
        classes = list()

        package = ""
        if self.package is not None:
            package = "Package: " + self.package + "<br/>"

        for classname in self.classes:
            classes.append(self.classes[classname].html())

        errs = ""
        for error in self.errors:
            if not len(errs):
                errs += "<tr><th colspan='2' align='left'>Errors</th></tr>"
            for part in ["type", "message", "text"]:
                if part in error:
                    errs += "<tr><td>{}</td><td><pre>{}</pre></td></tr>".format(
                        part,
                        tag.text(error[part]))

        stdio = ""
        if self.stderr or self.stdout:
            stdio += "<tr><th colspan='2' align='left'>Output</th></tr>"
            if self.stderr:
                 stdio += "<tr><td>Stderr</td><td><pre>{}</pre></td></tr>".format(
                        tag.text(self.stderr))
            if self.stdout:
                 stdio += "<tr><td>Stdout</td><td><pre>{}</pre></td></tr>".format(
                        tag.text(self.stdout))

        props = ""
        if len(self.properties):
            props += "<table>"
            propnames = sorted(self.properties)
            for prop in propnames:
                props += "<tr><th>{}</th><td>{}</td></tr>".format(prop, self.properties[prop])
            props += "</table>"

        return """
        <div class="testsuite">
            <h2>Test Suite: {name}</h2><a name="{anchor}">
            {package}
            {properties}
            <table>
            <tr><th align="left">Duration</th><td align="right">{duration} sec</td></tr>
            <tr><th align="left">Test Cases</th><td align="right">{count}</td></tr>
            <tr><th align="left">Failures</th><td align="right">{fails}</td></tr>
            {errs}
            {stdio}
            </table>
            <a name="toc"></a>
            <h2>Results Index</h2>
            {toc}
            <hr size="2"/>
            <h2>Test Results</h2>
            <div class="testclasses">
            {classes}
            </div>
        </div>
        """.format(name=tag.text(self.name),
                   anchor=self.anchor(),
                   duration=self.duration,
                   errs=errs,
                   stdio=stdio,
                   toc=self.toc(),
                   package=package,
                   properties=props,
                   classes="".join(classes),
                   count=len(self.all()),
                   fails=len(self.failed()))