/hg/rhino-tests: Added templates used to create test report.
ptisnovs at icedtea.classpath.org
ptisnovs at icedtea.classpath.org
Tue Jul 3 08:38:59 PDT 2012
changeset 7e2bc401aae8 in /hg/rhino-tests
details: http://icedtea.classpath.org/hg/rhino-tests?cmd=changeset;node=7e2bc401aae8
author: Pavel Tisnovsky <ptisnovs at redhat.com>
date: Tue Jul 03 17:41:22 2012 +0200
Added templates used to create test report.
Moved helped method to a TestResult class.
Changed the (not yet implemented) report generator methods.
diffstat:
ChangeLog | 14 +
src/org/RhinoTests/Reporter/HistoryPagesGenerator.java | 5 +-
src/org/RhinoTests/Reporter/IndexPageGenerator.java | 23 +--
src/org/RhinoTests/Reporter/Reporter.java | 4 +-
src/org/RhinoTests/Reporter/TestResult.java | 25 +++
templates/graph.html | 126 +++++++++++++++++
templates/index.html | 59 +++++++
templates/log.html | 28 +++
templates/style.css | 32 ++++
9 files changed, 291 insertions(+), 25 deletions(-)
diffs (396 lines):
diff -r ff6efa8d997f -r 7e2bc401aae8 ChangeLog
--- a/ChangeLog Mon Jul 02 11:08:50 2012 +0200
+++ b/ChangeLog Tue Jul 03 17:41:22 2012 +0200
@@ -1,3 +1,17 @@
+2012-07-03 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/org/RhinoTests/Reporter/HistoryPagesGenerator.java:
+ * src/org/RhinoTests/Reporter/IndexPageGenerator.java:
+ Changed the (not yet implemented) report generator methods.
+ * src/org/RhinoTests/Reporter/Reporter.java:
+ * src/org/RhinoTests/Reporter/TestResult.java:
+ Moved helped method to a TestResult class.
+ * templates/graph.html:
+ * templates/index.html:
+ * templates/log.html:
+ * templates/style.css:
+ Added templates used to create test report.
+
2012-07-02 Pavel Tisnovsky <ptisnovs at redhat.com>
* Makefile: Added new files to compile, added new targets
diff -r ff6efa8d997f -r 7e2bc401aae8 src/org/RhinoTests/Reporter/HistoryPagesGenerator.java
--- a/src/org/RhinoTests/Reporter/HistoryPagesGenerator.java Mon Jul 02 11:08:50 2012 +0200
+++ b/src/org/RhinoTests/Reporter/HistoryPagesGenerator.java Tue Jul 03 17:41:22 2012 +0200
@@ -40,6 +40,9 @@
package org.RhinoTests.Reporter;
+import java.util.List;
+import java.util.Map;
+
/**
*
* @author Pavel Tisnovsky
@@ -47,7 +50,7 @@
public class HistoryPagesGenerator
{
- public static void generate()
+ public static void generate(Map<String, Map<String, List<String>>> testResults, CommandLineParameters params)
{
// TODO Auto-generated method stub
diff -r ff6efa8d997f -r 7e2bc401aae8 src/org/RhinoTests/Reporter/IndexPageGenerator.java
--- a/src/org/RhinoTests/Reporter/IndexPageGenerator.java Mon Jul 02 11:08:50 2012 +0200
+++ b/src/org/RhinoTests/Reporter/IndexPageGenerator.java Tue Jul 03 17:41:22 2012 +0200
@@ -56,7 +56,7 @@
throw new RuntimeException("Results for " + params.getDate() + " don't exist");
}
Map<String, List<String>> testResultForDate = testResults.get(params.getDate());
- TestResult testResult = readSummary(testResultForDate);
+ TestResult testResult = TestResult.readSummary(testResultForDate);
createIndexPageFromTemplate(testResult, params);
}
@@ -84,25 +84,4 @@
FileUtils.writeTextFile(params.getReportDir() + "/index.html", out);
}
- private static TestResult readSummary(Map<String, List<String>> testResultForDate) {
- TestResult testResult = new TestResult();
- for (Map.Entry<String, List<String>> testResultContent : testResultForDate.entrySet()) {
- for (String logLine : testResultContent.getValue()) {
- if (logLine.startsWith("SUMMARY: ")) {
- final String strTotalTests = StringUtils.getSubstring(logLine, "total: ", "passed: ");
- final String strPassedTests = StringUtils.getSubstring(logLine, "passed: ", "failed: ");
- final String strFailedTests = StringUtils.getSubstring(logLine, "failed: ", "duration: ");
- final int totalTests =Integer.parseInt(strTotalTests);
- final int passedTests = Integer.parseInt(strPassedTests);
- final int failedTests = Integer.parseInt(strFailedTests);
- final int errorTests = totalTests - passedTests - failedTests;
- testResult.setPassed(testResult.getPassed() + passedTests);
- testResult.setFailed(testResult.getFailed() + failedTests);
- testResult.setError(testResult.getError() + errorTests);
- }
- }
- }
- return testResult;
- }
-
}
diff -r ff6efa8d997f -r 7e2bc401aae8 src/org/RhinoTests/Reporter/Reporter.java
--- a/src/org/RhinoTests/Reporter/Reporter.java Mon Jul 02 11:08:50 2012 +0200
+++ b/src/org/RhinoTests/Reporter/Reporter.java Tue Jul 03 17:41:22 2012 +0200
@@ -68,8 +68,8 @@
readTestResults();
createListOfAllTests();
IndexPageGenerator.generate(this.testResults, this.params);
- HistoryPagesGenerator.generate();
- GraphPagesGenerator.generate();
+ HistoryPagesGenerator.generate(this.testResults, this.params);
+ GraphPagesGenerator.generate(this.testResults, this.params);
LogPagesGenerator.generate(this.testResults, this.params);
}
diff -r ff6efa8d997f -r 7e2bc401aae8 src/org/RhinoTests/Reporter/TestResult.java
--- a/src/org/RhinoTests/Reporter/TestResult.java Mon Jul 02 11:08:50 2012 +0200
+++ b/src/org/RhinoTests/Reporter/TestResult.java Tue Jul 03 17:41:22 2012 +0200
@@ -40,6 +40,9 @@
package org.RhinoTests.Reporter;
+import java.util.List;
+import java.util.Map;
+
/**
@@ -98,4 +101,26 @@
public int getError() {
return this.error;
}
+
+ public static TestResult readSummary(Map<String, List<String>> testResultForDate) {
+ TestResult testResult = new TestResult();
+ for (Map.Entry<String, List<String>> testResultContent : testResultForDate.entrySet()) {
+ for (String logLine : testResultContent.getValue()) {
+ if (logLine.startsWith("SUMMARY: ")) {
+ final String strTotalTests = StringUtils.getSubstring(logLine, "total: ", "passed: ");
+ final String strPassedTests = StringUtils.getSubstring(logLine, "passed: ", "failed: ");
+ final String strFailedTests = StringUtils.getSubstring(logLine, "failed: ", "duration: ");
+ final int totalTests =Integer.parseInt(strTotalTests);
+ final int passedTests = Integer.parseInt(strPassedTests);
+ final int failedTests = Integer.parseInt(strFailedTests);
+ final int errorTests = totalTests - passedTests - failedTests;
+ testResult.setPassed(testResult.getPassed() + passedTests);
+ testResult.setFailed(testResult.getFailed() + failedTests);
+ testResult.setError(testResult.getError() + errorTests);
+ }
+ }
+ }
+ return testResult;
+ }
+
}
diff -r ff6efa8d997f -r 7e2bc401aae8 templates/graph.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/graph.html Tue Jul 03 17:41:22 2012 +0200
@@ -0,0 +1,126 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <title>Rhino tests report – graph for ${TEST_COUNT} tests</title>
+ <meta name="Author" content="Pavel Tisnovsky" />
+ <meta name="Generator" content="org.RhinoTests.Reporter.Reporter" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <link type="text/css" rel="StyleSheet" href="style.css" />
+
+ <script type="text/javascript" src="flotr/lib/prototype-1.6.0.2.js"></script>
+ <!--[if IE]>
+ <script type="text/javascript" src="flotr/lib/excanvas.js"></script>
+ <script type="text/javascript" src="flotr/lib/base64.js"></script>
+ <![endif]-->
+ <script type="text/javascript" src="flotr/lib/canvas2image.js"></script>
+ <script type="text/javascript" src="flotr/lib/canvastext.js"></script>
+ <script type="text/javascript" src="flotr/flotr-0.2.0-alpha.js"></script>
+
+ </head>
+<html>
+ <h1>Rhino tests report - graph for ${TEST_COUNT} tests</h1>
+
+ <table border="0">
+ <tr>
+ <td valign="top">
+ <div id="graph1" style="width:1600px;height:500px;"></div>
+ <div id="graph2" style="width:1600px;height:500px;"></div>
+ <script type="text/javascript">
+ /**
+ * Wait till dom's finished loading.
+ */
+ document.observe('dom:loaded', function(){
+ var d_passed = [
+${GRAPH_DATA_PASSED}
+ ];
+ var d_failed = [
+${GRAPH_DATA_FAILED}
+ ];
+ var d_error = [
+${GRAPH_DATA_ERROR}
+ ];
+ /**
+ * Draw the graph in the first container.
+ */
+ Flotr.draw(
+ $('graph1'),
+ [
+ {data:d_passed, mouse:{track: true}, label:'PASSED', lines:{fill:false}},
+ {data:d_failed, mouse:{track: true}, label:'FAILED', lines:{fill:false}},
+ {data:d_error, mouse:{track: true}, label:'ERROR', lines:{fill:false}},
+ ],
+ {
+ lines: {show: true}, points: {show: true},
+ //{bars: {show:true, barWidth:0.5},
+ xaxis: {tickFormatter: function(n) { return ""+Math.floor(n)+"";}},
+ yaxis: {min: 0},
+ legend: {
+ position: 'sw',
+ backgroundColor: '#D2E8FF'
+ },
+ mouse: {
+ track: true,
+ color: 'purple',
+ sensibility: 5,
+ trackDecimals: 2,
+ trackFormatter: function(obj){ return 'count: ' + obj.y; },
+ }
+ }
+ );
+ });
+ </script>
+ <script type="text/javascript">
+ /**
+ * Wait till dom's finished loading.
+ */
+ document.observe('dom:loaded', function(){
+ var d_failed = [
+${GRAPH_DATA_FAILED}
+ ];
+ var d_error = [
+${GRAPH_DATA_ERROR}
+ ];
+ /**
+ * Draw the graph in the second container.
+ */
+ Flotr.draw(
+ $('graph2'),
+ [
+ {data:d_failed, mouse:{track: true}, label:'FAILED', lines:{fill:false}},
+ {data:d_error, mouse:{track: true}, label:'ERROR', lines:{fill:false}},
+ ],
+ {
+ lines: {show: true}, points: {show: true},
+ //{bars: {show:true, barWidth:0.5},
+ xaxis: {tickFormatter: function(n) { return ""+Math.floor(n)+"";}},
+ yaxis: {min: 0},
+ legend: {
+ position: 'sw',
+ backgroundColor: '#D2E8FF'
+ },
+ mouse: {
+ track: true,
+ color: 'purple',
+ sensibility: 5,
+ trackDecimals: 2,
+ trackFormatter: function(obj){ return 'count: ' + obj.y; },
+ }
+ }
+ );
+ });
+ </script>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table border="2" frame="border" rules="all" cellspacing="1" cellpadding="1" style="background-color: #f0f0dd; vertical-align: top; border-collapse: collapse; border-color:#808080">
+ <tr><td>#</td><td>Date</td><td>Passed</td><td>Failed</td><td>Error</td></tr>
+${TABLE_DATA}
+ </table>
+ </td>
+ </tr>
+ </table>
+ <hr />
+</html>
+
diff -r ff6efa8d997f -r 7e2bc401aae8 templates/index.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/index.html Tue Jul 03 17:41:22 2012 +0200
@@ -0,0 +1,59 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <title>Rhino tests report</title>
+ <meta name="Author" content="Pavel Tisnovsky" />
+ <meta name="Generator" content="org.RhinoTests.Reporter.Reporter" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <link type="text/css" rel="StyleSheet" href="style.css" />
+ </head>
+<html>
+ <h1>Rhino tests report</h1>
+
+ <br />
+
+ <table border='2' frame='border' rules='all' cellspacing='1' cellpadding='1' class='forms' style='width:1000px' summary=''>
+ <tr><td colspan='4' class='table-header'>Daily report</td></tr>
+ <tr>
+ <td rowspan='3' class='group-id'>${DATE}</td>
+ <td>Log location:</td>
+ <td colspan='3'><a href='log_${DATE}.html'>
+ log_${DATE}.html</a></td>
+ </tr>
+ <tr>
+ <td style='width:24%' class='passed-header'>Passed</td>
+ <td style='width:24%' class='failed-header'>Failed</td>
+ <td style='width:24%' class='error-header'>Error</td>
+ </tr>
+ <tr>
+ <td style='width:24%' class='passed-text'>${PASSED}</td>
+ <td style='width:24%' class='failed-text'>${FAILED}</td>
+ <td style='width:24%' class='error-text'>${ERROR}</td>
+ </tr>
+ <tr>
+ <td colspan='4'> </td>
+ </tr>
+ <tr><td colspan='4' class='table-header'>Full history</td></tr>
+ <tr>
+ <td> </td><td colspan='3'><a href='hist_all_tests.html'>All tests (huge page!)</a></td>
+ </tr>
+ <tr>
+ <td> </td><td colspan='3'><a href='hist_failed_tests.html'>Failed tests (more useful)</a></td>
+ </tr>
+ <tr>
+ <td> </td><td colspan='3'>Last <i>n</i> results: <a href='hist_10.html'>[10]</a><a href='hist_20.html'>[20]</a><a href='hist_30.html'>[30]</a></td>
+ </tr>
+ <tr>
+ <td colspan='4'> </td>
+ </tr>
+ <tr><td colspan='4' class='table-header'>Graphs</td></tr>
+ <tr>
+ <td> </td><td colspan='3'><a href='graph_all_tests.html'>All tests</a></td>
+ </tr>
+ <tr>
+ <td> </td><td colspan='3'>Last <i>n</i> results: <a href='graph_10.html'>[10]</a><a href='graph_20.html'>[20]</a><a href='graph_30.html'>[30]</a></td>
+ </tr>
+ </table>
+</html>
+
diff -r ff6efa8d997f -r 7e2bc401aae8 templates/log.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/log.html Tue Jul 03 17:41:22 2012 +0200
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+ <head>
+ <title>Rhino tests log for date ${DATE}</title>
+ <meta name="Author" content="Pavel Tisnovsky" />
+ <meta name="Generator" content="org.RhinoTests.Reporter.Reporter" />
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <link type="text/css" rel="StyleSheet" href="style.css" />
+ </head>
+<html>
+ <h1>Rhino tests log for date ${DATE}</h1>
+
+ <br />
+
+ <table border='2' frame='border' rules='all' cellspacing='1' cellpadding='1' class='forms' style='width:1000px' summary=''>
+ <tr><td class='table-header'>Summary</td></tr>
+ ${SUMMARY}
+ </table>
+
+ <br />
+ <br />
+
+ <table border='2' frame='border' rules='all' cellspacing='1' cellpadding='1' class='forms' style='width:1000px' summary=''>
+ ${RESULTS}
+ </table>
+</html>
+
diff -r ff6efa8d997f -r 7e2bc401aae8 templates/style.css
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/style.css Tue Jul 03 17:41:22 2012 +0200
@@ -0,0 +1,32 @@
+body {font-family: arial, helvetica, sans-serif; color:#000000; text-align:justify; background-color:#ffffff; margin-left: 0px; margin-top: 0px}
+h1 {font-family: arial, helvetica, sans-serif; color:#000000; background:#80a0a0; text-align:center; padding-left: 1em; margin: 0}
+h2 {font-family: arial, helvetica, sans-serif; color:#000000; background:#c0c060; padding-left: 1em; padding-right:1cm}
+h3 {font-family: arial, helvetica, sans-serif; color:#000000; background:#a0a080; padding-left: 1em; padding-right:1cm}
+h4 {font-family: arial, helvetica, sans-serif; color:#000000; background:#c0c0a0; padding-left: 1em; padding-right:1cm; margin-bottom: 5px}
+a {font-family: arial, helvetica, sans-serif; color:#0000ff; text-decoration:none}
+a:link {color:#0000ff}
+a:visited {color:#0000ff}
+a:visited {color:#0000ff}
+a:hover {color:#ffffff; background:#404040}
+p {font-family: arial, helvetica, sans-serif; color:#000000; text-align:justify; padding-left:1em; padding-right:1em}
+li {font-family: arial, helvetica, sans-serif; color:#000000; text-align:justify}
+pre {}
+tr {font-family: arial, helvetica, sans-serif; text-align:left}
+td {font-family: arial, helvetica, sans-serif; text-align:left}
+td.center {font-family: arial, helvetica, sans-serif; text-align:center}
+th.center {font-family: arial, helvetica, sans-serif; text-align:center}
+
+.forms {background-color: #f0f0dd; vertical-align: top; width: 720px; border-collapse: collapse; border-color:#808080; margin-left:32px}
+
+.group-id {background-color:#c0c0a0; border-color: black; border-width:2px; text-align:center;font-size:200%}
+.table-header {background-color:#a0c0c0; font-size:120%}
+
+.passed-header {background-color:#80ff80}
+.failed-header {background-color:#ff8080}
+.error-header {background-color:#8080ff}
+
+.passed-text {color:#006000}
+.failed-text {color:#600000}
+.error-text {color:#000080}
+.stack-trace {color:#604040}
+
More information about the distro-pkg-dev
mailing list