Skip to content

Commit

Permalink
Merge pull request sahana#746 from arnavsharma93/master
Browse files Browse the repository at this point in the history
Fixing a bug in report generation
  • Loading branch information
flavour committed Mar 31, 2014
2 parents 6ed8c3b + 6297a2b commit 76f54eb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
22 changes: 18 additions & 4 deletions modules/tests/HTMLTestRunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,14 @@ class Template_mixin(object):
<td>%(Pass)s</td>
<td>%(fail)s</td>
<td>%(error)s</td>
<td><a href="javascript:showClassDetail('%(cid)s',%(count)s)">Detail</a></td>
</tr>
""" # variables: (style, desc, count, Pass, fail, error, cid)
# Use it with REPORT_CLASS_TMPL_ADD_LINK to complete the table

REPORT_CLASS_TMPL_ADD_LINK = r"""
<td><a href="javascript:showClassDetail('%(cid)s',%(count)s)">Detail</a></td>
</tr>
""" # variables: (cid, count)
# Use it after REPORT_CLASS_TMPL

REPORT_TEST_WITH_OUTPUT_TMPL = r"""
<tr id='%(tid)s' class='%(Class)s'>
Expand Down Expand Up @@ -570,8 +574,8 @@ def stopTest(self, test):


def addSuccess(self, test):
# broken_links testcase passes by default; calling addSuccess.
# Below condition checks if a link failed in smoke tests and if it did; addFailure
# broken_links testcase passes by default; calling addSuccess.
# Below condition checks if a link failed in smoke tests and if it did; addFailure
# is called
if "smoke_results" in current.data:
if current.data['smoke_results']['broken_links_count'] != 0:
Expand Down Expand Up @@ -766,6 +770,16 @@ def _generate_report(self, result):
error = ne,
cid = 'c%s' % (cid+1),
)
# Only one row is generated in smoke tests
if 'smoke_results' in current.data:
total_count = 1
else:
total_count = np+nf+ne
row = row + self.REPORT_CLASS_TMPL_ADD_LINK % dict(
count = total_count,
cid = 'c%s' % (cid+1),
)

rows.append(row)

for tid, (n,t,o,e) in enumerate(cls_results):
Expand Down
4 changes: 2 additions & 2 deletions modules/tests/smoke/broken_links.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" Sahana Eden Test Framework
@copyright: 2011-2012 (c) Sahana Software Foundation
@copyright: 2011-2014 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
Expand Down Expand Up @@ -536,7 +536,7 @@ def timeReport(self):
total = len(linktimes)
average = numpy.mean(linktimes)
std = numpy.std(linktimes)
msg = "%s links visited with an average time of %s and standard deviation of %s" % (total, average, std)
msg = "%s links visited with an average time of %.3f and standard deviation of %.3f" % (total, average, std)
self.reporter(msg)

def scatterplot(self):
Expand Down

0 comments on commit 76f54eb

Please sign in to comment.