Added case-run history graph to show_case.cgi

This commit is contained in:
ghendricks%novell.com 2006-10-17 23:18:23 +00:00
Родитель b706cd5d8b
Коммит e789f7c88f
5 изменённых файлов: 107 добавлений и 4 удалений

Просмотреть файл

@ -367,6 +367,32 @@ sub get_priority_list {
return $ref
}
=head2 get_caserun_count
Takes a status and returns the count of that status
=cut
sub get_caserun_count {
my $self = shift;
my ($status) = @_;
my $dbh = Bugzilla->dbh;
my $query = "SELECT COUNT(*)
FROM test_case_runs
WHERE case_id = ? ";
$query .= "AND case_run_status_id = ?" if $status;
my $count;
if ($status){
($count) = $dbh->selectrow_array($query,undef,($self->id,$status));
}
else {
($count) = $dbh->selectrow_array($query,undef,$self->id);
}
return $count;
}
=head2 add_tag
Associates a tag with this test case

Просмотреть файл

@ -230,6 +230,7 @@
[%##### Reports #####%]
<br><br>
<h3>Reports</h3>
<img src="tr_case_reports.cgi?case_id=[% case.id FILTER none %]&type=status-breakdown">
[%##### Attachments #####%]
<br><br>
<h3>Attachments</h3>

Просмотреть файл

Просмотреть файл

@ -0,0 +1,78 @@
#!/usr/bin/perl -wT
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
#
# Contributor(s): Maciej Maczynski <macmac@xdsnet.pl>
# Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
use strict;
use lib ".";
use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Util;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Constants;
use vars qw($template $vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
Bugzilla->login();
print $cgi->header();
my $case_id = trim(Bugzilla->cgi->param('case_id') || '');
unless ($case_id){
$vars->{'form_action'} = 'tr_case_reports.cgi';
$template->process("testopia/case/choose.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
validate_test_id($case_id, 'case');
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
my $case = Bugzilla::Testopia::TestCase->new($case_id);
my $type = $cgi->param('type') || '';
if ($type eq 'status-breakdown'){
my @data;
my $caserun = Bugzilla::Testopia::TestCaseRun->new({});
my @names;
my @values;
foreach my $status (@{$caserun->get_status_list}){
push @names, $status->{'name'};
push @values, $case->get_caserun_count($status->{'id'});
}
push @data, \@names;
push @data, \@values;
$vars->{'width'} = 200;
$vars->{'height'} = 150;
$vars->{'data'} = \@data;
$vars->{'chart_title'} = 'Historic Status Breakdown';
$vars->{'colors'} = (['#858aef', '#56e871', '#ed3f58', '#b8eae1', '#f1d9ab', '#e17a56']);
$template->process("testopia/reports/pie.png.tmpl", $vars)
|| ThrowTemplateError($template->error());
}

Просмотреть файл

@ -32,13 +32,11 @@ use Bugzilla::Testopia::Util;
use vars qw($template $vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
Bugzilla->login();
print Bugzilla->cgi->header();
print $cgi->header();
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $plan_id = trim(Bugzilla->cgi->param('plan_id') || '');
unless ($plan_id){