diff options
author | Jiri Vanek <[email protected]> | 2011-06-16 16:23:26 +0200 |
---|---|---|
committer | Jiri Vanek <[email protected]> | 2011-06-16 16:23:26 +0200 |
commit | 20ab54395604e6f1258a5feccc7040a4b26b9c22 (patch) | |
tree | 3839a09043d05f78004def86417684ca10a6e233 | |
parent | 9c4b0a7764e967c9273fae59b632ca06145d5219 (diff) |
added styles for junit xml report
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | Makefile.am | 16 | ||||
-rw-r--r-- | tests/report-styles/index.js | 20 | ||||
-rw-r--r-- | tests/report-styles/jreport.xsl | 229 | ||||
-rw-r--r-- | tests/report-styles/report.css | 21 |
5 files changed, 298 insertions, 2 deletions
@@ -1,3 +1,17 @@ +2011-06-16 Jiri Vanek <[email protected]> + + * tests/report-styles/index.js: fast navigation functions + * tests/report-styles/report.css: styles for transformed result + * tests/report-styles/jreport.xsl: template for human-readable + xml->html transformation. + * Makefile.am: New variable for report-styles directory; + ($(TESTS_DIR)/$(REPORT_STYLES_DIRNAME)): goal for copying styles and + javascripts; (run-netx-unit-tests): added nonfaling xsltproc + transformation of sheet and unit-tests' xml report to index_unit.html; + (clean-netx-unit-tests): now depends also on clean_tests_reports; + (clean_tests_reports): new goal to remove report styles directory and + indexs html files. + 2011-06-14 Andrew Su <[email protected]> * netx/net/sourceforge/jnlp/controlpanel/ControlPanel.java: diff --git a/Makefile.am b/Makefile.am index a924e97..231e64f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,6 +6,8 @@ NETX_RESOURCE_DIR=$(NETX_SRCDIR)/net/sourceforge/jnlp/resources NETX_EXTRA_DIR=$(abs_top_srcdir)/extra/net/sourceforge/javaws/about/resources NETX_EXTRA_DIST_DIR=$(abs_top_builddir)/extra-lib/net/sourceforge/javaws/about/resources +REPORT_STYLES_DIRNAME=report-styles + TESTS_SRCDIR=$(abs_top_srcdir)/tests TESTS_DIR=$(abs_top_builddir)/tests.build @@ -460,8 +462,13 @@ stamps/netx-unit-tests-compile.stamp: stamps/netx.stamp \ mkdir -p stamps && \ touch $@ +$(TESTS_DIR)/$(REPORT_STYLES_DIRNAME): + mkdir $(TESTS_DIR)/$(REPORT_STYLES_DIRNAME) + cp $(TESTS_SRCDIR)/$(REPORT_STYLES_DIRNAME)/*.css $(TESTS_DIR)/$(REPORT_STYLES_DIRNAME)/ + cp $(TESTS_SRCDIR)/$(REPORT_STYLES_DIRNAME)/*.js $(TESTS_DIR)/$(REPORT_STYLES_DIRNAME)/ + run-netx-unit-tests: stamps/netx-unit-tests-compile.stamp \ - $(JUNIT_RUNNER_JAR) + $(JUNIT_RUNNER_JAR) $(TESTS_DIR)/$(REPORT_STYLES_DIRNAME) cp {$(NETX_UNIT_TEST_SRCDIR),$(NETX_UNIT_TEST_DIR)}/net/sourceforge/jnlp/basic.jnlp cd $(NETX_UNIT_TEST_DIR) ; \ class_names= ; \ @@ -476,6 +483,7 @@ run-netx-unit-tests: stamps/netx-unit-tests-compile.stamp \ > stdout.log 2> stderr.log ; \ cat stdout.log ; \ cat stderr.log >&2 + -xsltproc $(TESTS_SRCDIR)/$(REPORT_STYLES_DIRNAME)/jreport.xsl $(TESTS_DIR)/netx/unit/tests-output.xml > $(TESTS_DIR)/index_unit.html clean-netx-tests: clean-netx-unit-tests clean-junit-runner if [ -e $(TESTS_DIR)/netx ]; then \ @@ -487,11 +495,15 @@ clean-junit-runner: rm -rf $(JUNIT_RUNNER_DIR) rm -f $(JUNIT_RUNNER_JAR) -clean-netx-unit-tests: +clean-netx-unit-tests: clean_tests_reports rm -f netx-unit-tests-source-files.txt rm -rf $(NETX_UNIT_TEST_DIR) rm -f stamps/netx-unit-tests-compile.stamp +clean_tests_reports: + rm -rf $(TESTS_DIR)/$(REPORT_STYLES_DIRNAME)/ + rm -f $(TESTS_DIR)/index*.html + # plugin tests if ENABLE_PLUGIN diff --git a/tests/report-styles/index.js b/tests/report-styles/index.js new file mode 100644 index 0000000..27b6ed5 --- /dev/null +++ b/tests/report-styles/index.js @@ -0,0 +1,20 @@ + +function negateIdDisplay(which) { + var e = document.getElementById(which); + if (e.style.display=="block") { + e.style.display="none" + } else { + e.style.display="block" + } +} + + +function setClassDisplay(which,what) { + var e = document.getElementsByClassName(which); + for ( var i = 0; i < e.length; i++ ) { + e[i].style.display=what + } +} + + + diff --git a/tests/report-styles/jreport.xsl b/tests/report-styles/jreport.xsl new file mode 100644 index 0000000..bafe2c8 --- /dev/null +++ b/tests/report-styles/jreport.xsl @@ -0,0 +1,229 @@ +<?xml version="1.0"?> +<!-- + +This file is part of IcedTea. + +IcedTea is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +IcedTea is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with IcedTea; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. + + --> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> + <xsl:template match="/"> +<html> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + </meta> + <script src="report-styles/index.js"> + </script> + <link href="report-styles/report.css" rel="stylesheet" type="text/css"> + </link> + </head> +<body onload='setClassDisplay("trace","none");'> + <div id="wholePage"> + <h3>Date:</h3> + <xsl:value-of select="/testsuite/date"/> + <br/> + <h2>Result: (<xsl:value-of select="round(sum(/testsuite/testcase/@time))"/>s)</h2> + <div class="tablee"> + <div class="row"> + <div class="cell1">TOTAL: </div> + <div class="cell2"> + <xsl:value-of select="/testsuite/stats/summary/total"/> + </div> + <div class="space-line"></div> + </div> + <div class="row passed"> + <div class="cell1">passed: </div> + <div class="cell2"> + <xsl:value-of select="/testsuite/stats/summary/passed"/> + </div> + <div class="space-line"></div> + </div> + <div class="row failed"> + <div class="cell1">failed: </div> + <div class="cell2"> + <xsl:value-of select="/testsuite/stats/summary/failed"/> + </div> + <div class="space-line"></div> + </div> + <div class="row ignored"> + <div class="cell1">ignored: </div> + <div class="cell2"> + <xsl:value-of select="/testsuite/stats/summary/ignored"/> + </div> + <div class="space-line"></div> + </div> + </div> + <h2>Classes:</h2> + <xsl:for-each select="/testsuite/stats/classes/class"> + <div> + <xsl:attribute name="class"> + <xsl:choose> + <xsl:when test="passed = total"> + passed + </xsl:when> + <xsl:otherwise> + failed + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <a class="classSumaryName"><xsl:attribute name="href"> + #<xsl:value-of select="@name"/> + </xsl:attribute><xsl:value-of select="@name"/> +(<xsl:value-of select="@time"/>ms): +</a> + </div> + <blockquote> + <div class="tablee"> + <div class="row"> + <div class="cell1">TOTAL: </div> + <div class="cell2"> + <xsl:value-of select="total"/> + </div> + <div class="space-line"></div> + </div> + <div class="row passed"> + <div class="cell1">passed: </div> + <div class="cell2"> + <xsl:value-of select="passed"/> + </div> + <div class="space-line"></div> + </div> + <div class="row failed"> + <div class="cell1">failed: </div> + <div class="cell2"> + <xsl:value-of select="failed"/> + </div> + <div class="space-line"></div> + </div> + <div class="row ignored"> + <div class="cell1">ignored: </div> + <div class="cell2"> + <xsl:value-of select="ignored"/> + </div> + <div class="space-line"></div> + </div> + </div> + </blockquote> + <hr/> + </xsl:for-each> + + + <h2>Individual results:</h2> + <button onclick="setClassDisplay('trace','none')">NoneTrace</button> + <button onclick="setClassDisplay('trace','block')">AllTraces</button> + <xsl:for-each select="/testsuite/testcase"> + <div> + <xsl:attribute name="class"> + <xsl:choose> + <xsl:when test="error"> + failed + </xsl:when> + <xsl:otherwise> + passed + </xsl:otherwise> + </xsl:choose> + </xsl:attribute> + <a> + <xsl:attribute name="name"> + <xsl:value-of select="normalize-space(@classname)"/> + </xsl:attribute> + </a> + <div class="lineHeader"> + <div class="clazz"> + <xsl:value-of select="@classname"/> + </div> + <xsl:text disable-output-escaping="no"> - </xsl:text> + <div class="method"> + <xsl:value-of select="@name"/> + </div> + </div> + <div class="result"> + <xsl:choose> + <xsl:when test="not(error)"> + <div class="status"> + PASSED (<xsl:value-of select="@time"/>s) + </div> + </xsl:when> + <xsl:otherwise> + <div class="status"> + FAILED (<xsl:value-of select="@time"/>s) + </div> + <div class="wtrace"> + <div class="theader"> + <xsl:value-of select="error/@type"/> <xsl:text disable-output-escaping="no"> - </xsl:text> + <xsl:value-of select="error/@message"/> + <button onclick="negateIdDisplay('{generate-id(error)}')">StackTrace</button> + </div> + <div class="trace" id="{generate-id(error)}"> + <pre> + <xsl:value-of select="error"/> + </pre> + </div> + </div> + </xsl:otherwise> + </xsl:choose> + <div class="space-line"></div> + </div> + <div class="space-line"></div> + </div> + <div class="space-line"></div> + </xsl:for-each> + + <div class="stbound"> + <div class="theader stExt2"> + STD-OUT - <button onclick="negateIdDisplay('{generate-id(/testsuite/system-out)}')">Show/hide</button> + </div> + <div class="trace stExt3" id="{generate-id(/testsuite/system-out)}"> + <pre> + <xsl:value-of select="/testsuite/system-out"/> + </pre> + </div> + </div> + <div class="space-line"></div> + <div class="stbound"> + <div class="theader stExt2"> + STD-ERR - <button onclick="negateIdDisplay('{generate-id(/testsuite/system-err)}')">Show/hide</button> + </div> + <div class="trace stExt3" id="{generate-id(/testsuite/system-err)}"> + <pre> + <xsl:value-of select="/testsuite/system-err"/> + </pre> + </div> + </div> + <div class="space-line"></div> + + </div> + </body> + </html> + </xsl:template> +</xsl:stylesheet> diff --git a/tests/report-styles/report.css b/tests/report-styles/report.css new file mode 100644 index 0000000..e0a59c3 --- /dev/null +++ b/tests/report-styles/report.css @@ -0,0 +1,21 @@ +div.passed {background-color:green;height:auto } +div.failed {background-color:red ;height:auto} +div.ignored {background-color:yellow ;height:auto} + +div.clazz {display:inline } +div.method {display:inline } + +div.result {display:block; border: thin solid black ;height:auto} +div.status {display:inline; } +div.wtrace {display:inline; border: thin solid black; float: right;height:auto} +div.theader {display:block; border: thin solid black} +div.trace {display:block; border: thin solid black} + +div.space-line { clear: both; margin: 0; padding: 0; width: auto;} + +div.tablee {width:200px; border: thin solid black; } +div.row { border: thin solid black; } +div.cell1 {display:inline; float: left;height:auto} +div.cell2 {display:inline; float: right;height:auto} + +a.classSumaryName{font-weight:bold} |