Unverified Commit 04bc66a9 authored by boklm's avatar boklm
Browse files

Add html tests report

parent 978f775f
......@@ -15,6 +15,7 @@ use IO::Socket::INET;
use JSON;
use File::Copy;
use Image::Resize;
use Template;
my %tests = (
tbbScreenshot => { type => 'mozmill' },
......@@ -259,6 +260,25 @@ sub test_sha {
}
}
sub make_report {
my $template = Template->new(
ENCODING => 'utf8',
INCLUDE_PATH => "$FindBin::Bin/tmpl",
OUTPUT_PATH => $options->{'reports-dir'},
);
my $vars = {
options => $options,
results => \%results,
};
for my $page (qw(index.html screenshots.html)) {
$template->process($page, $vars, $page, binmode => ':utf8');
}
foreach my $tbbfile (keys %results) {
$vars->{tbbfile} = $tbbfile;
$template->process('report.html', $vars, "$tbbfile.html", binmode => ':utf8');
}
}
sub test_tbb {
my ($tbbfile, $sha256sum) = @_;
my $oldcwd = getcwd;
......@@ -294,3 +314,4 @@ foreach my $tbbfile (@{$options->{files}}) {
test_tbb($tbbfile);
}
print "Reports directory: $options->{'reports-dir'}\n";
make_report;
<html>
<head>
<title>Tests reports</title>
<style type="text/css">
.test_ok {
color: #006600;
font-weight: bold;
}
.test_notok {
color: #FF0000;
font-weight: bold;
}
</style>
</head>
<body>
<h1>Bundle list</h1>
<ul>
[% FOREACH tbbfile IN results.keys %]
<li><a href="[% tbbfile %].html">[% tbbfile %]</a>:
[% IF results.$tbbfile.success %]
<span class="test_ok">OK</a>
[% ELSE %]
<span class="test_notok">NOT OK</a>
[% END %]
</li>
[% END %]
</ul>
<hr>
<a href="screenshots.html">screenshots</a>
</body>
</html>
<html>
<head>
<title>[% tbbfile %] test report</title>
<style type="text/css">
.test_ok {
color: #006600;
}
.test_notok {
color: #FF0000;
}
</style>
</head>
<body>
<h1>Bundle infos</h1>
<ul>
<li><b>Filename:</b> [% results.$tbbfile.filename %]</li>
<li><b>Version:</b> [% results.$tbbfile.version %]</li>
<li><b>Language:</b> [% results.$tbbfile.language %]</li>
<li><b>OS:</b> [% results.$tbbfile.os %]</li>
<li><b>Architecture:</b> [% results.$tbbfile.arch %]</li>
<li><b>sha256sum:</b> [% results.$tbbfile.sha256sum %]</li>
</ul>
<h1>Results</h1>
[% FOREACH test IN results.$tbbfile.tests.values %]
<h3>[% test.name %]</h3>
<ul>
<li><b>Test type:</b> [% test.type %]</li>
[% IF test.type == 'mozmill' %]
<li><b>Status:</b>
[% IF test.results.results.0.failed == 0 %]
<span class="test_ok">OK</span>
[% ELSE %]
<span class="test_notok">NOT OK</span>
[% END %]
</li>
<li><b>Passed tests:</b>
[% GET test.results.results.0.passed %]/[% GET test.results.results.0.passed + test.results.results.0.failed %]
</li>
<li><a href="results-[% tbbfile %]/[% test.name %].json">json results</a></li>
[% END %]
</ul>
[% END %]
<hr>
<h1>Screenshots</h1>
[% FOREACH test IN results.$tbbfile.tests.values %]
[% IF test.screenshots %]
<h3>[% test.name %]</h3>
[% FOREACH screenshot IN test.screenshots %]
<a href="results-[% tbbfile %]/[% screenshot %]"><img src="results-[% tbbfile %]/t-[% screenshot %]" /></a><br />
[% END %]
[% END %]
[% END %]
</body>
</html>
<html>
<head>
<title>Tests screenshots</title>
<style type="text/css">
.test_ok {
color: #006600;
font-weight: bold;
}
.test_notok {
color: #FF0000;
font-weight: bold;
}
</style>
</head>
<body>
[% FOREACH tbbfile IN results.keys %]
<h1>[% tbbfile %]</h1>
[% FOREACH test IN results.$tbbfile.tests.values %]
[% FOREACH screenshot IN test.screenshots %]
<a href="results-[% tbbfile %]/[% screenshot %]"><img src="results-[% tbbfile %]/t-[% screenshot %]" /></a><br />
[% END %]
[% END %]
<hr />
[% END %]
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment