Full HTML report.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Sun, 13 Sep 2015 20:43:20 +0000 (22:43 +0200)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Sun, 13 Sep 2015 20:43:20 +0000 (22:43 +0200)
app.py
static/style.css
templates/output.html

diff --git a/app.py b/app.py
index 6bd302b..a2cd8de 100755 (executable)
--- a/app.py
+++ b/app.py
@@ -44,15 +44,15 @@ class SubmitForm(Form):
 
 @app.route('/', methods=['GET', 'POST'])
 def launch():
-    error = None
+    error = False
 
     if request.method == 'POST':
-        opts = []
+        opts = ['--format', 'htmltable']
         for p in params.keys():
             if p in request.form and request.form[p]:
                 opts.append(params[p])
                 opts.append(request.form[p])
-        opts.append('-t')
+        opts.append('--tests')
         opts.append(','.join(request.form.getlist('tests')))
         #print opts
 
@@ -63,11 +63,11 @@ def launch():
             pOCCI.main(opts)
         except SystemExit as se:
             if se.args[0] >= 2:
-                error = 'Fatal error.'
+                error = True
         sys.stdout = sys.__stdout__
         sys.stderr = sys.__stderr__
 
-        return render_template('output.html', result = out[0].getvalue() + out[1].getvalue(), error = error)
+        return render_template('output.html', result = out[0].getvalue(), stderr = out[1].getvalue(), error = error)
 
     form = SubmitForm()
 
index d909c29..96194da 100644 (file)
@@ -1 +1,6 @@
 label.field {font-weight: bold;}
+th {text-align:left;}
+td.ok {color:green;}
+td.fail {color:red;}
+td.skipped {color:orange;}
+span.fail {font-size:large;}
index 6d97a01..3996694 100644 (file)
@@ -7,9 +7,23 @@
 </head>
 
 <body>
-    <pre>{{ result }}</pre>
 {% if error %}
-    <p>{{error}}
+
+    <p><span class="fail">{{result}}</span>
+{% else %}
+    <table>
+        <tr>
+            <th>Test</th>
+            <th>Running Time</th>
+            <th>Status</th>
+            <th>Reason</th>
+        </tr>
+{{ result|safe }}
+    </table>
+{% endif %}
+{% if stderr %}
+
+    <p><span class="fail">{{stderr}}</span>
 {% endif %}
 </body>