changeset 309:1df44410c40a 0.5.x

Ported [320] to 0.5.x.
author cmlenz
date Fri, 18 Nov 2005 21:10:38 +0000
parents 556dbf79394a
children 053abf910d01
files bitten/trac_ext/htdocs/bitten.css bitten/trac_ext/summarizers.py bitten/trac_ext/templates/bitten_summary_coverage.cs bitten/trac_ext/templates/bitten_summary_tests.cs
diffstat 4 files changed, 39 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/bitten/trac_ext/htdocs/bitten.css
+++ b/bitten/trac_ext/htdocs/bitten.css
@@ -150,6 +150,18 @@
  clear: both; padding: 5px; }
 #content.build .tab-content table { margin: 0; }
 
+#content.build tbody.totals td, #content.build tbody.totals th {
+ font-weight: bold;
+}
+#content.build table.tests tr.failed { background: #d99; }
+#content.build table.tests tr.failed td { font-weight: bold; }
+#content.build table.tests tr.failed:hover td,
+#content.build table.tests tr.failed:hover tr { background: #966; }
+#content.build table.tests tr.failed :link,
+#content.build table.tests tr.failed :visited { color: #933 }
+#content.build table.tests tr.failed :link:hover,
+#content.build table.tests tr.failed :visited:hover { color: #fff; }
+
 #content.build .log { border: 1px inset; overflow: auto; max-height: 30em;
  width: 100%; white-space: pre; }
 #content.build .log code { padding: 0 5px; }
--- a/bitten/trac_ext/summarizers.py
+++ b/bitten/trac_ext/summarizers.py
@@ -48,14 +48,20 @@
 GROUP BY file, fixture ORDER BY fixture""", (build.id,))
 
         data = []
+        total_success, total_failure, total_error = 0, 0, 0
         for fixture, file, num_success, num_failure, num_error in cursor:
             data.append({'name': fixture, 'num_success': num_success,
                          'num_error': num_error, 'num_failure': num_failure})
+            total_success += num_success
+            total_failure += num_failure
+            total_error += num_error
             if file:
                 data[-1]['href'] = self.env.href.browser(config.path, file)
 
         hdf = HDFWrapper(loadpaths=Chrome(self.env).get_all_templates_dirs())
         hdf['data'] = data
+        hdf['totals'] = {'success': total_success, 'failure': total_failure,
+                        'error': total_error}
         return hdf.render('bitten_summary_tests.cs')
 
 
@@ -90,11 +96,17 @@
 GROUP BY file, unit ORDER BY unit""", (build.id,))
 
         data = []
+        total_loc, total_cov = 0, 0
         for unit, file, loc, cov in cursor:
-            data.append({'name': unit, 'loc': loc, 'cov': cov})
+            loc, cov = int(loc), float(cov)
+            if loc:
+                data.append({'name': unit, 'loc': loc, 'cov': int(cov)})
+                total_loc += loc
+                total_cov += loc * cov
             if file:
                 data[-1]['href'] = self.env.href.browser(config.path, file)
 
         hdf = HDFWrapper(loadpaths=Chrome(self.env).get_all_templates_dirs())
         hdf['data'] = data
+        hdf['totals'] = {'loc': total_loc, 'cov': int(total_cov / total_loc)}
         return hdf.render('bitten_summary_coverage.cs')
--- a/bitten/trac_ext/templates/bitten_summary_coverage.cs
+++ b/bitten/trac_ext/templates/bitten_summary_coverage.cs
@@ -1,7 +1,7 @@
 <h3>Code Coverage</h3>
 <table class="listing coverage">
  <thead><tr><th class="name">Unit</th><th class="loc">Lines of Code</th>
- <th clsas="cov">Coverage</th></tr></thead>
+ <th class="cov">Coverage</th></tr></thead>
  <tbody><?cs
  each:item = data ?><tr><td class="name"><?cs
   if:item.href ?><a href="<?cs var:item.href ?>"><?cs var:item.name ?></a><?cs
@@ -9,4 +9,8 @@
   /if ?></td><td class="loc"><?cs
   var:item.loc ?></td><td class="cov"><?cs var:item.cov ?>%</td></tr><?cs
  /each ?></tbody>
+ <tbody class="totals"><tr>
+  <th>Total</th><td><?cs var:totals.loc ?></td>
+  <td><?cs var:totals.cov ?>%</td>
+ </tr></tbody>
 </table>
--- a/bitten/trac_ext/templates/bitten_summary_tests.cs
+++ b/bitten/trac_ext/templates/bitten_summary_tests.cs
@@ -5,12 +5,19 @@
   <th>Failures</th><th>Errors</th>
  </tr></thead>
  <tbody><?cs
- each:item = data ?><tr><td><?cs
+ each:item = data ?><tr<?cs
+  if:item.num_failure != 0 || item.num_error != 0 ?> class="failed"<?cs
+  /if ?>><th><?cs
   if:item.href ?><a href="<?cs var:item.href ?>"><?cs var:item.name ?></a><?cs
   else ?><?cs var:item.name ?><?cs
-  /if ?></td><td><?cs
+  /if ?></th><td><?cs
   var:#item.num_success + #item.num_failure + #item.num_error ?></td><td><?cs
   var:item.num_failure ?></td><td><?cs
   var:item.num_error ?></td></tr><?cs
  /each ?></tbody>
+ <tbody class="totals"><tr>
+  <th>Total</th>
+  <td><?cs var:totals.success ?></td>
+  <td><?cs var:totals.failure ?></td><td><?cs var:totals.error ?></td>
+ </tr></tbody>
 </table>
Copyright (C) 2012-2017 Edgewall Software