Backed out change to test case runs.

This commit is contained in:
ghendricks%novell.com 2007-06-19 05:08:33 +00:00
Родитель dfcb16bdd6
Коммит 0a27b3a395
15 изменённых файлов: 153 добавлений и 452 удалений

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

@ -1087,6 +1087,11 @@ sub init {
push @wherepart, 'test_plans.isactive = 1'; push @wherepart, 'test_plans.isactive = 1';
} }
} }
if ($obj eq 'case_run'){
unless ($cgi->param('isactive')){
push @wherepart, 'test_case_runs.iscurrent = 1';
}
}
my @funcnames; my @funcnames;
while (@funcdefs) { while (@funcdefs) {

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

@ -75,6 +75,7 @@ use Date::Parse;
notes notes
running_date running_date
close_date close_date
iscurrent
sortkey sortkey
=cut =cut
@ -92,6 +93,7 @@ use constant DB_COLUMNS => qw(
notes notes
running_date running_date
close_date close_date
iscurrent
sortkey sortkey
); );
@ -207,7 +209,7 @@ sub store {
# Exclude the auto-incremented field from the column list. # Exclude the auto-incremented field from the column list.
my $columns = join(", ", grep {$_ ne 'case_run_id'} DB_COLUMNS); my $columns = join(", ", grep {$_ ne 'case_run_id'} DB_COLUMNS);
$dbh->do("INSERT INTO test_case_runs ($columns) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", $dbh->do("INSERT INTO test_case_runs ($columns) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)",
undef, undef,
($self->{'run_id'}, # run_id ($self->{'run_id'}, # run_id
$self->{'case_id'}, # case_id $self->{'case_id'}, # case_id
@ -220,7 +222,8 @@ sub store {
undef, # notes undef, # notes
undef, # running_date undef, # running_date
undef, # close_date undef, # close_date
0 # sortkey 1, # iscurrent
0, # sortkey
)); ));
my $key = $dbh->bz_last_key( 'test_case_runs', 'case_run_id' ); my $key = $dbh->bz_last_key( 'test_case_runs', 'case_run_id' );
@ -229,7 +232,7 @@ sub store {
=head2 clone =head2 clone
Creates a copy of this caserun Creates a copy of this caserun and sets it as the current record
=cut =cut
@ -242,7 +245,7 @@ sub clone {
my $columns = join(", ", grep {$_ ne 'case_run_id'} DB_COLUMNS); my $columns = join(", ", grep {$_ ne 'case_run_id'} DB_COLUMNS);
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
$dbh->do("INSERT INTO test_case_runs ($columns) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)", $dbh->do("INSERT INTO test_case_runs ($columns) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)",
undef, undef,
($run_id, # run_id ($run_id, # run_id
$case_id, # case_id $case_id, # case_id
@ -255,11 +258,13 @@ sub clone {
undef, # notes undef, # notes
undef, # running_date undef, # running_date
undef, # close_date undef, # close_date
1, # iscurrent
0, # sortkey 0, # sortkey
)); ));
my $key = $dbh->bz_last_key( 'test_case_runs', 'case_run_id' ); my $key = $dbh->bz_last_key( 'test_case_runs', 'case_run_id' );
$self->set_as_current($key);
return $key; return $key;
} }
@ -297,7 +302,25 @@ sub switch {
my $oldenv = $self->{'environment_id'}; my $oldenv = $self->{'environment_id'};
$self = Bugzilla::Testopia::TestCaseRun->new($self->clone($build_id,$env_id)); $self = Bugzilla::Testopia::TestCaseRun->new($self->clone($build_id,$env_id));
if ($oldbuild != $build_id){
my $build = Bugzilla::Testopia::Build->new($oldbuild);
my $note = "Build Changed by ". Bugzilla->user->login;
$note .= ". Old build: '". $build->name;
$note .= "' New build: '". $self->build->name;
$note .= "'. Resetting to IDLE.";
$self->append_note($note);
} }
if ($oldenv != $env_id){
my $environment = Bugzilla::Testopia::Environment->new($oldenv);
my $note = "Environment Changed by ". Bugzilla->user->login;
$note .= ". Old environment: '". $environment->name;
$note .= "' New environment: '". $self->environment->name;
$note .= "'. Resetting to IDLE.";
$self->append_note($note);
}
}
$self->set_as_current;
return $self; return $self;
} }
@ -331,6 +354,32 @@ sub _update_fields{
return $self->{'case_run_id'}; return $self->{'case_run_id'};
} }
=head2 set_as_current
Sets this case-run as the current or active one in the history
list of case-runs of this build and case_id
=cut
sub set_as_current {
my $self = shift;
my ($caserun) = @_;
$caserun = $self->{'case_run_id'} unless defined $caserun;
my $dbh = Bugzilla->dbh;
$dbh->bz_lock_tables('test_case_runs WRITE');
$dbh->do("UPDATE test_case_runs
SET iscurrent = 0
WHERE case_id = ? AND run_id = ?",
undef, ($self->case_id, $self->run_id));
$dbh->do("UPDATE test_case_runs
SET iscurrent = 1
WHERE case_run_id = ?",
undef, $caserun);
$dbh->bz_unlock_tables;
}
=head2 set_status =head2 set_status
Sets the status on a case-run and updates the close_date and testedby Sets the status on a case-run and updates the close_date and testedby
@ -369,6 +418,7 @@ sub set_status {
} }
my $note = "Status changed from $oldstatus to $newstatus by ". Bugzilla->user->login; my $note = "Status changed from $oldstatus to $newstatus by ". Bugzilla->user->login;
$note .= " for build '". $self->build->name ."' and environment '". $self->environment->name;
$self->append_note($note); $self->append_note($note);
$self->{'case_run_status_id'} = $status_id; $self->{'case_run_status_id'} = $status_id;
$self->{'status'} = undef; $self->{'status'} = undef;
@ -380,8 +430,8 @@ sub set_sortkey {
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
$dbh->do("UPDATE test_case_runs SET sortkey = ? $dbh->do("UPDATE test_case_runs SET sortkey = ?
WHERE case_run_id = ?", WHERE case_id = ? AND run_id = ?",
undef, ($sortkey, $self->id)); undef, ($sortkey, $self->case_id, $self->run_id));
} }
@ -403,6 +453,8 @@ sub set_assignee {
my $note = "Assignee changed from $oldassignee to ". $newassignee->login; my $note = "Assignee changed from $oldassignee to ". $newassignee->login;
$note .= " by ". Bugzilla->user->login; $note .= " by ". Bugzilla->user->login;
$note .= " for build '". $self->build->name;
$note .= "' and environment '". $self->environment->name;
$self->append_note($note); $self->append_note($note);
} }
@ -465,8 +517,8 @@ sub append_note {
Private method for updating blocked test cases. If the pre-requisite Private method for updating blocked test cases. If the pre-requisite
case fails, the blocked test cases in a run get a status of BLOCKED case fails, the blocked test cases in a run get a status of BLOCKED
if it passes they are set back to IDLE. This only happens if it doesn't if it passes they are set back to IDLE. This only happens to the
already have a closed status. current case run and only if it doesn't already have a closed status.
=cut =cut
sub _update_deps { sub _update_deps {
@ -480,7 +532,8 @@ sub _update_deps {
my $caseruns = $dbh->selectcol_arrayref( my $caseruns = $dbh->selectcol_arrayref(
"SELECT case_run_id "SELECT case_run_id
FROM test_case_runs FROM test_case_runs
WHERE run_id = ? WHERE iscurrent = 1
AND run_id = ?
AND case_run_status_id IN(". join(',', (IDLE,RUNNING,PAUSED,BLOCKED)) .") AND case_run_status_id IN(". join(',', (IDLE,RUNNING,PAUSED,BLOCKED)) .")
AND case_id IN (". join(',', @$deplist) .")", AND case_id IN (". join(',', @$deplist) .")",
undef, $self->{'run_id'}); undef, $self->{'run_id'});
@ -701,6 +754,10 @@ Returns the notes of the object
Returns the time stamp of when this case-run was closed Returns the time stamp of when this case-run was closed
=head2 iscurrent
Returns true if this is the current case-run in the history list
=head2 status_id =head2 status_id
Returns the status id of the object Returns the status id of the object
@ -729,6 +786,7 @@ sub assignee { return Bugzilla::User->new($_[0]->{'assignee'}); }
sub case_text_version { return $_[0]->{'case_text_version'}; } sub case_text_version { return $_[0]->{'case_text_version'}; }
sub running_date { return $_[0]->{'running_date'}; } sub running_date { return $_[0]->{'running_date'}; }
sub close_date { return $_[0]->{'close_date'}; } sub close_date { return $_[0]->{'close_date'}; }
sub iscurrent { return $_[0]->{'iscurrent'}; }
sub status_id { return $_[0]->{'case_run_status_id'}; } sub status_id { return $_[0]->{'case_run_status_id'}; }
sub sortkey { return $_[0]->{'sortkey'}; } sub sortkey { return $_[0]->{'sortkey'}; }
sub isprivate { return $_[0]->{'isprivate'}; } sub isprivate { return $_[0]->{'isprivate'}; }
@ -758,8 +816,9 @@ sub notes {
my $notes = $dbh->selectcol_arrayref( my $notes = $dbh->selectcol_arrayref(
"SELECT notes "SELECT notes
FROM test_case_runs FROM test_case_runs
WHERE case_run_id = ?", WHERE case_id = ? AND run_id = ?
undef,($self->id)); ORDER BY case_run_id",
undef,($self->case_id, $self->run_id));
return join("\n", @$notes); return join("\n", @$notes);
} }

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

@ -1290,7 +1290,7 @@ sub test_case_run_count {
"SELECT count(case_run_id) FROM test_case_runs "SELECT count(case_run_id) FROM test_case_runs
INNER JOIN test_runs ON test_case_runs.run_id = test_runs.run_id INNER JOIN test_runs ON test_case_runs.run_id = test_runs.run_id
INNER JOIN test_plans ON test_runs.plan_id = test_plans.plan_id INNER JOIN test_plans ON test_runs.plan_id = test_plans.plan_id
WHERE test_plans.plan_id = ?"; WHERE test_case_runs.iscurrent = 1 AND test_plans.plan_id = ?";
$query .= " AND test_case_runs.case_run_status_id = ?" if $status_id; $query .= " AND test_case_runs.case_run_status_id = ?" if $status_id;
my $count; my $count;
if ($status_id){ if ($status_id){
@ -1311,7 +1311,7 @@ sub builds_seen {
"SELECT DISTINCT test_case_runs.build_id "SELECT DISTINCT test_case_runs.build_id
FROM test_case_runs FROM test_case_runs
INNER JOIN test_runs ON test_case_runs.run_id = test_runs.run_id INNER JOIN test_runs ON test_case_runs.run_id = test_runs.run_id
WHERE test_runs.plan_id = ?", WHERE test_runs.plan_id = ? AND test_case_runs.iscurrent = 1",
undef,$self->id); undef,$self->id);
my @o; my @o;
@ -1329,7 +1329,7 @@ sub environments_seen {
"SELECT DISTINCT test_case_runs.environment_id "SELECT DISTINCT test_case_runs.environment_id
FROM test_case_runs FROM test_case_runs
INNER JOIN test_runs ON test_case_runs.run_id = test_runs.run_id INNER JOIN test_runs ON test_case_runs.run_id = test_runs.run_id
WHERE test_runs.plan_id = ?", WHERE test_runs.plan_id = ? AND test_case_runs.iscurrent = 1",
undef,$self->id); undef,$self->id);
my @o; my @o;

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

@ -292,12 +292,8 @@ the test_case_runs table
sub add_case_run { sub add_case_run {
my $self = shift; my $self = shift;
my ($case_id, $build_id, $env_id) = @_; my ($case_id) = @_;
return 0 if $self->check_case($case_id);
$build_id ||= $self->build->id;
$env_id ||= $self->environment_id;
return 0 if $self->check_case($case_id,$build_id,$env_id);
my $case = Bugzilla::Testopia::TestCase->new($case_id); my $case = Bugzilla::Testopia::TestCase->new($case_id);
return 0 if $case->status ne 'CONFIRMED'; return 0 if $case->status ne 'CONFIRMED';
my $assignee = $case->default_tester ? $case->default_tester->id : undef; my $assignee = $case->default_tester ? $case->default_tester->id : undef;
@ -306,8 +302,8 @@ sub add_case_run {
'case_id' => $case_id, 'case_id' => $case_id,
'assignee' => $assignee, 'assignee' => $assignee,
'case_text_version' => $case->version, 'case_text_version' => $case->version,
'build_id' => $build_id, 'build_id' => $self->build->id,
'environment_id' => $env_id, 'environment_id' => $self->environment_id,
}); });
$caserun->store; $caserun->store;
} }
@ -494,15 +490,13 @@ Checks if the given test case is already associated with this run
sub check_case { sub check_case {
my $self = shift; my $self = shift;
my ($case_id, $build_id, $env_id) = @_; my ($case_id) = @_;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my ($value) = $dbh->selectrow_array( my ($value) = $dbh->selectrow_array(
"SELECT case_run_id "SELECT case_run_id
FROM test_case_runs FROM test_case_runs
WHERE case_id = ? AND run_id = ? AND build_id = ? AND environment_id = ?", WHERE case_id = ? AND run_id = ?",
undef, ($case_id, $self->{'run_id'}, $build_id, $env_id)); undef, ($case_id, $self->{'run_id'}));
return $value; return $value;
} }
@ -1007,13 +1001,8 @@ associated with this run
sub cases { sub cases {
my $self = shift; my $self = shift;
return $self->{'cases'} if exists $self->{'cases'}; return $self->{'cases'} if exists $self->{'cases'};
my $dbh = Bugzilla->dbh;
my @cases; my @cases;
my $ref = $dbh->selectcol_arrayref( foreach my $cr (@{$self->current_caseruns}){
"SELECT DISTINCT case_id
FROM test_case_runs
WHERE run_id = ?", undef, $self->id);
foreach my $cr (@$ref){
push @cases, Bugzilla::Testopia::TestCase->new($cr); push @cases, Bugzilla::Testopia::TestCase->new($cr);
} }
$self->{'cases'} = \@cases; $self->{'cases'} = \@cases;
@ -1033,7 +1022,7 @@ sub case_count {
my ($count) = $dbh->selectrow_array( my ($count) = $dbh->selectrow_array(
"SELECT COUNT(case_run_id) FROM test_case_runs "SELECT COUNT(case_run_id) FROM test_case_runs
WHERE run_id=?", undef, WHERE run_id=? AND iscurrent=1", undef,
$self->{'run_id'}); $self->{'run_id'});
return scalar $count; return scalar $count;
@ -1046,7 +1035,7 @@ sub case_run_count {
my $query = my $query =
"SELECT COUNT(*) "SELECT COUNT(*)
FROM test_case_runs FROM test_case_runs
WHERE run_id = ?"; WHERE run_id = ? AND iscurrent = 1";
$query .= " AND case_run_status_id = ?" if $status_id; $query .= " AND case_run_status_id = ?" if $status_id;
my $count; my $count;
@ -1067,7 +1056,7 @@ sub finished_count {
my ($count) = $dbh->selectrow_array( my ($count) = $dbh->selectrow_array(
"SELECT COUNT(*) "SELECT COUNT(*)
FROM test_case_runs FROM test_case_runs
WHERE run_id = ? WHERE run_id = ? AND iscurrent = 1
AND case_run_status_id IN (?,?,?)",undef, ($self->id, FAILED, PASSED, BLOCKED)); AND case_run_status_id IN (?,?,?)",undef, ($self->id, FAILED, PASSED, BLOCKED));
return $count; return $count;
@ -1101,6 +1090,30 @@ sub percent_of_finished {
return calculate_percent($self->finished_count,$self->case_run_count($status_id)); return calculate_percent($self->finished_count,$self->case_run_count($status_id));
} }
=head2 current_caseruns
Returns a reference to a list of TestCaseRun objects that are the
current case-runs on this run
=cut
sub current_caseruns {
my $self = shift;
my $dbh = Bugzilla->dbh;
return $self->{'current_caseruns'} if exists $self->{'current_caseruns'};
my $ref = $dbh->selectcol_arrayref(
"SELECT case_run_id FROM test_case_runs
WHERE run_id=? AND iscurrent=1", undef,
$self->{'run_id'});
my @caseruns;
foreach my $id (@{$ref}){
push @caseruns, Bugzilla::Testopia::TestCaseRun->new($id);
}
$self->{'current_caseruns'} = \@caseruns;
return $self->{'current_caseruns'};
}
=head2 caseruns =head2 caseruns
Returns a reference to a list of TestCaseRun objects that belong Returns a reference to a list of TestCaseRun objects that belong
@ -1132,13 +1145,12 @@ Returns a list of case_id's from the current case runs.
sub case_id_list { sub case_id_list {
my $self = shift; my $self = shift;
my $dbh = Bugzilla->dbh; my @ids;
my $ref = $dbh->selectcol_arrayref( foreach my $c (@{$self->current_caseruns}){
"SELECT DISTINCT case_id push @ids, $c->case_id;
FROM test_case_runs }
WHERE run_id = ?", undef, $self->id);
return join(",", @$ref); return join(",", @ids);
} }
=head1 SEE ALSO =head1 SEE ALSO

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

@ -105,6 +105,7 @@ $schema->{test_case_runs} = {
running_date => {TYPE => 'DATETIME'}, running_date => {TYPE => 'DATETIME'},
close_date => {TYPE => 'DATETIME'}, close_date => {TYPE => 'DATETIME'},
notes => {TYPE => 'TEXT'}, notes => {TYPE => 'TEXT'},
iscurrent => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => '0'},
sortkey => {TYPE => 'INT4'}, sortkey => {TYPE => 'INT4'},
environment_id => {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1}, environment_id => {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1},
], ],

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

@ -59,9 +59,7 @@ sub testopiaUpdateDB {
$dbh->bz_drop_table('test_category_templates'); $dbh->bz_drop_table('test_category_templates');
$dbh->bz_drop_table('test_plan_testers'); $dbh->bz_drop_table('test_plan_testers');
$dbh->bz_drop_table('test_plan_group_map'); $dbh->bz_drop_table('test_plan_group_map');
$dbh->bz_drop_column('test_plans', 'editor_id'); $dbh->bz_drop_column('test_plans', 'editor_id');
$dbh->bz_drop_column('test_case_runs', 'iscurrent');
$dbh->bz_add_column('test_case_bugs', 'case_id', {TYPE => 'INT4', UNSIGNED => 1}); $dbh->bz_add_column('test_case_bugs', 'case_id', {TYPE => 'INT4', UNSIGNED => 1});
$dbh->bz_add_column('test_case_runs', 'environment_id', {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1}, 0); $dbh->bz_add_column('test_case_runs', 'environment_id', {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1}, 0);
@ -79,7 +77,7 @@ sub testopiaUpdateDB {
$dbh->bz_add_column('test_plan_types', 'description', {TYPE => 'MEDIUMTEXT'}, 0); $dbh->bz_add_column('test_plan_types', 'description', {TYPE => 'MEDIUMTEXT'}, 0);
$dbh->bz_add_column('test_case_status', 'description', {TYPE => 'MEDIUMTEXT'}, 0); $dbh->bz_add_column('test_case_status', 'description', {TYPE => 'MEDIUMTEXT'}, 0);
$dbh->bz_add_column('test_case_run_status', 'description', {TYPE => 'MEDIUMTEXT'}, 0); $dbh->bz_add_column('test_case_run_status', 'description', {TYPE => 'MEDIUMTEXT'}, 0);
$dbh->bz_add_column('test_case_runs', 'iscurrent', {TYPE => 'INT1', NOTNULL => 1, DEFAULT => 0}, 0);
fixTables(); fixTables();
$dbh->bz_alter_column('test_attachment_data', 'attachment_id', {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1}); $dbh->bz_alter_column('test_attachment_data', 'attachment_id', {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1});
@ -98,6 +96,7 @@ sub testopiaUpdateDB {
$dbh->bz_alter_column('test_case_runs', 'case_id', {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1}); $dbh->bz_alter_column('test_case_runs', 'case_id', {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1});
$dbh->bz_alter_column('test_case_runs', 'case_run_id', {TYPE => 'INTSERIAL', PRIMARYKEY => 1, NOTNULL => 1}); $dbh->bz_alter_column('test_case_runs', 'case_run_id', {TYPE => 'INTSERIAL', PRIMARYKEY => 1, NOTNULL => 1});
$dbh->bz_alter_column('test_case_runs', 'environment_id', {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1}); $dbh->bz_alter_column('test_case_runs', 'environment_id', {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1});
$dbh->bz_alter_column('test_case_runs', 'iscurrent', {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => '0'});
$dbh->bz_alter_column('test_case_runs', 'run_id', {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1}); $dbh->bz_alter_column('test_case_runs', 'run_id', {TYPE => 'INT4', UNSIGNED => 1, NOTNULL => 1});
$dbh->bz_alter_column('test_case_run_status', 'case_run_status_id', {TYPE => 'TINYSERIAL', PRIMARYKEY => 1, NOTNULL => 1}); $dbh->bz_alter_column('test_case_run_status', 'case_run_status_id', {TYPE => 'TINYSERIAL', PRIMARYKEY => 1, NOTNULL => 1});
$dbh->bz_alter_column('test_cases', 'case_id', {TYPE => 'INTSERIAL', PRIMARYKEY => 1, NOTNULL => 1}); $dbh->bz_alter_column('test_cases', 'case_id', {TYPE => 'INTSERIAL', PRIMARYKEY => 1, NOTNULL => 1});

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

@ -4,7 +4,7 @@
<a name="testopia" /> <a name="testopia" />
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr> <tr>
<th colspan="2">Testopia Version 1.2</th> <th colspan="2">Testopia Version 1.3</th>
</tr> </tr>
<tr valign="TOP"> <tr valign="TOP">
<td width="128"> <td width="128">

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

@ -1,154 +0,0 @@
[%# 1.0@bugzilla.org %]
[%# 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): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
#%]
[%# INTERFACE:
# ...
#%]
<script type="text/javascript">
dojo.require("dojo.widget.Select");
dojo.addOnLoad(
function() {
dojo.widget.manager.getWidgetById('assignee').setValue('[% dotweak ? '' : caserun.assignee.login FILTER none %]');
dojo.widget.manager.getWidgetById('assignee').setLabel('[% dotweak ? '' : caserun.assignee.login FILTER none %]');
}
);
</script>
[% IF single %]
[% build_list = caserun.run.plan.product.builds(1) %]
[% default_build = caserun.build.id %]
[% ELSE %]
[% default_build = "--Do Not Change--" %]
[% END %]
<table>
<tr>
[% IF NOT dotweak %]
<td align="center" valign="top" width="50%">
[% IF caserun.bugs.size > 0 %]
<table>
<tr class="bz_row_header">
<th colspan="3" >[% terms.Bugs %]</th>
</tr>
<tr class="bz_row_header">
<th>ID</th><th>Summary</th><th>Remove</th>
</tr>
[% FOREACH bug = caserun.bugs %]
<tr>
<td>[% bug.bug_id FILTER bug_link(bug.bug_id) %] </td>
<td>[% bug.short_desc FILTER html %]</td>
<td><a href="tr_show_caserun.cgi?caserun_id=[% caserun.id FILTER none %]&bug_id=[% bug.bug_id FILTER none %]&action=detach_bug"><img src="testopia/img/del.gif" alt="detach bug" /></a>
</tr>
[% END %]
</table>
[% END %]
</td>
<td align="center" valign="top" width="50%">
[% IF caserun.case.bugs.size > 0 %]
<table>
<tr class="bz_row_header">
<th colspan="3" >[% terms.Bugs %] in all runs</th>
</tr>
<tr class="bz_row_header">
<th>ID</th><th>Summary</th>
</tr>
[% FOREACH bug = caserun.case.bugs %]
<tr>
<td>[% bug.bug_id FILTER bug_link(bug.bug_id) %] </td>
<td>[% bug.short_desc FILTER html %]</td>
</tr>
[% END %]
</table>
[% END %]
</td>
[% END %]
</tr>
</table>
<table>
<tr>
<th align="right">Assignee</th>
<td><input dojoType="Select"
dataUrl="tr_quicksearch.cgi?action=getuser&search=${searchString}"
mode="remote"
autoComplete="true"
id="assignee"
name="assignee"
maxListLength="10"
style="width:200px; height:15px"
value="[% dotweak ? '' : caserun.assignee.login FILTER html %]" >
</td>
<th align="right">Attach [% terms.Bugs %]</th>
<td><input name="bugs">&nbsp;<a href="enter_bug.cgi?product=[% caserun.run.plan.product.name FILTER url_quote %]&caserun_id=[% caserun.id FILTER none %]" target="_blank"><img src="testopia/img/snew.gif" alt="Log a New Bug" title="Log a New Bug" style="vertical-align:text-bottom;" /></a>
<br><input type="checkbox" style="border: none" value="1" name="update_bug" id="update_bug">Update [% terms.bug %] status </td>
</tr>
</table>
<table>
<tr>
<td colspan="2" valign="top">
<table>
<tr>
<th colspan="3" class="bz_row_header">Status</th>
</tr>
[% FOREACH status = caserun.get_status_list %]
<tr>
<td><label for="[% status.name FILTER none %]"><img src="testopia/img/[% status.name FILTER none %].gif" alt="[% status.name FILTER none %]"></label></td>
<td align="right"><input type="radio" style="border: none" name="status" id="[% status.name FILTER none %]" value="[% status.id FILTER none %]" [% 'checked="checked"' IF caserun.status == status.name AND NOT dotweak %]></td>
<th align="left"><label for="[% status.name FILTER none %]">[% status.name FILTER html %]</label></th>
</tr>
[% END %]
[% IF dotweak %]
<tr>
<td>&nbsp;</td>
<td align="right"><input type="radio" style="border: none" name="status" value="-1" [% 'checked="checked"' IF dotweak %]></td>
<th align="left"><label for="[% status.name FILTER none %]">No Change</label></th>
</tr>
[% END %]
</table>
</td>
<td colspan="2" align="center" valign="top">
<table>
[% IF single %]
<tr>
<th class="bz_row_header">Notes</th>
</tr>
<tr>
<td><div style="height:200px; width: 600px; border: 1px solid #000; overflow: auto; background-color: #f8f8f8"><pre>[% caserun.notes FILTER html %]</pre></div></td>
</tr>
[% END %]
<tr>
<th class="bz_row_header">Append a New Note</th>
</tr>
<tr>
<td><textarea name="notes" cols="80" rows="5" style="width: 600px"></textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right" colspan="4">
<input type="hidden" name="caserun_id" value="[% caserun.id FILTER none %]">
<input type="submit" name="action" value="Commit">
</td>
</tr>
</table>
</div>

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

@ -1,88 +0,0 @@
[%# 1.0@bugzilla.org %]
[%# 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): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
#%]
[%# INTERFACE:
# ...
#%]
[%############################################################################%]
[%# Template Initialization #%]
[%############################################################################%]
[% PROCESS global/variables.none.tmpl %]
[% title = "Test Case Runs" %]
[%############################################################################%]
[%# Page Header #%]
[%############################################################################%]
[% PROCESS global/header.html.tmpl
style_urls = ['testopia.css'] %]
[% PROCESS testopia/style.none.tmpl %]
[% PROCESS testopia/blocks.html.tmpl %]
[% PROCESS testopia/messages.html.tmpl %]
<script type="text/javascript">
djConfig = {
parseWidgets: false,
searchIds: ["assignee"]
};
</script>
<script src="testopia/js/util.js" type="text/javascript"></script>
<script src="testopia/dojo/dojo.js" type="text/javascript"></script>
[% IF table.list_count && run %]
[% PROCESS "testopia/caserun/filter.html.tmpl" %]
[% END %]
<form id="table" action="tr_list_caseruns.cgi" method="POST">
<br/>
[% IF table.list_count %]
[% PROCESS "testopia/caserun/case-history.html.tmpl" %]
[% IF candelete %]
<p align="right"><input type="submit" name="action" value="Delete Selected" /></p>
[% END %]
[% END %]
<p>
[% IF table.list_count == 0 %]
No test case runs
[% ELSE %]
[% IF table.list_count == 1 %]
One test caserun
[% ELSE %]
[% table.list_count %] test case runs
[% END %]
[% END %]
found.
</p>
[% IF dotweak AND table.list_count %]
<h3>Update Selected Test Case-Runs</h3>
[% PROCESS testopia/caserun/form.html.tmpl %]
[% END %]
<input type="hidden" name="run_id" value="[% run.id FILTER none %]"/>
</form>
[%############################################################################%]
[%# Page Footer #%]
[%############################################################################%]
[% PROCESS global/footer.html.tmpl %]

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

@ -1,70 +0,0 @@
[%# 1.0@bugzilla.org %]
[%# 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): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
#%]
[% PROCESS testopia/blocks.html.tmpl %]
<td valign="top" width="24">
<table style="border-spacing:0px;border-collapse:collapse;" width="24">
<tr>
[% IF !caserun.canedit %]
<td valign="middle" style="cursor:pointer;" onclick="sr([% index %]);">
<img src="testopia/img/lk.gif" width="13" height="15" alt="locked" title="Locked: This run is stopped" border="0"/>
</td>
[% END %]
<td valign="bottom" style="padding:2;border-width:0; cursor:pointer;" onclick="sr([% index %]);">
<img id="id[% index %]" src="testopia/img/[% updating ? 'td.gif' : 'tr.gif' %]" width="11" height="11" alt="click to expand" border="0"/>
</td>
</tr>
</table>
</td>
<td align="left"><a href="tr_show_case.cgi?case_id=[% caserun.case.id FILTER none %]" title="[% caserun.case.summary FILTER html %]">[% caserun.case.id FILTER html %]</a></td>
<td align="right"><input name="sortkey_[% index %]" id="sortkey_[% index %]" value="[% caserun.sortkey FILTER html %]" size="5">
[% IF caserun.canedit %]
<input type="button" value="Change" onclick="chSortKey([% index %], [% caserun.id FILTER none %], document.getElementById('sortkey_[% index %]').value);"></td>
[% END %]
<td>
[% caserun.build.name FILTER html %]
</td>
<td>
<a href="tr_show_environment.cgi?env_id=[% caserun.environment.id FILTER none %]">[% caserun.environment.name FILTER html %]</a>
</td>
<td align="left" valign="top"><span id="own[% index %]"><a href="mailto:[% caserun.assignee.login %]">[% caserun.assignee.login %]</a></span></td>
<td align="left" valign="top"><span id="tdb[% index %]"><a href="mailto:[% caserun.testedby.login %]">[% caserun.testedby.login %]</a></span></td>
<td align="left" valign="top">
<span id="cld[% index %]">[% caserun.close_date FILTER time %] </span>
</td>
<td align="center" valign="top" onclick="sr([% index %]);">
<span style="width:14px;display:table-cell; align: center; cursor:pointer;">
<img id="xs[% caserun.id FILTER none %]"
src="testopia/img/[% caserun.status FILTER none %]_small.gif" title="[% caserun.status FILTER none %]" alt="[% caserun.status FILTER none %]"
width="14" height="14"/>
</span>
</td>
<td align="left" valign="top">[% caserun.case.priority FILTER html %]</td>
<td align="left" valign="top">[% caserun.case.category.name FILTER html %]</td>
<td align="left" valign="top">[% caserun.case.components.0.name FILTER html %][% '...' IF caserun.case.components.size > 1 %]</td>
<td align="center" valign="top"><span id="nbgs[% index %]">
[% FOREACH bug = caserun.bugs %]
[% bug.bug_id FILTER bug_link(bug.bug_id) %]
[% END %]</span></td>

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

@ -46,8 +46,7 @@
<script type="text/javascript"> <script type="text/javascript">
djConfig = { djConfig = {
parseWidgets: false, parseWidgets: false,
searchIds: ["manager","percent_bar","environment","caserun_env","tags","newtag","tagTable","tip_[% run.id FILTER none %]","caseruns_table",[% FOREACH cr = table.list %]"head_caserun_[% loop.count %]"[%',' UNLESS loop.last %][% END %]] searchIds: ["manager","percent_bar","environment","tags","newtag","tagTable","tip_[% run.id FILTER none %]","caseruns_table",[% FOREACH cr = table.list %]"env_[% loop.count %]","head_caserun_[% loop.count %]"[%',' UNLESS loop.last %][% END %]]
}; };
</script> </script>
<script src="testopia/js/util.js" type="text/javascript"></script> <script src="testopia/js/util.js" type="text/javascript"></script>
@ -175,42 +174,6 @@
<h3>Test Case Run Logs</h3><a name="table" /> <h3>Test Case Run Logs</h3><a name="table" />
[% PROCESS testopia/caserun/filter.html.tmpl %] [% PROCESS testopia/caserun/filter.html.tmpl %]
<br/> <br/>
[% IF run.canedit %]
<form action="tr_show_run.cgi" method="post">
<table>
<tr class="bz_row_header">
<th>Cases (comma separated)</th>
<th>Build</th>
<th>Environment</th>
</tr>
<tr>
<td><input name="newcases"></td>
<td align="right" valign="top">
[% PROCESS select sel = { name => "caserun_build",
list => run.plan.product.builds(1),
}
%]
</td>
<td align="left" valign="top">
<input dojoType="select"
dataUrl="tr_quicksearch.cgi?action=getenv&prod_id=[% run.plan.product.id FILTER none %]&search=${searchString}"
mode="remote"
autoComplete="false"
name="caserun_env"
id="caserun_env"
maxListLength="10">
</td>
</tr>
<tr>
<td align="right" colspan="3">
<input type="submit" name="action" id="action" value="New Case-Run" />
<input type="hidden" name="run_id" value="[% run.id FILTER none %]">
or <a href="tr_list_cases.cgi?addrun=[% run.id FILTER none %]&case_status=CONFIRMED&plan_id=[% run.plan.id FILTER none %]">Add several at once</a>
</td>
</tr>
</table>
</form>
[% END %]
[% PROCESS testopia/caserun/table.html.tmpl %] [% PROCESS testopia/caserun/table.html.tmpl %]
[% table.list_count FILTER none %] test cases found. [% table.list_count FILTER none %] test cases found.

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

@ -106,7 +106,15 @@ if ($action eq 'Commit'){
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
} }
my $build = $cgi->param('caserun_build') == -1 ? $caserun->build->id : $cgi->param('caserun_build');
my $notes = $cgi->param('notes'); my $notes = $cgi->param('notes');
my $env = $cgi->param('caserun_env') eq '' ? $caserun->environment->id : $cgi->param('caserun_env');
validate_test_id($build, 'build');
validate_test_id($env, 'environment');
detaint_natural($env);
detaint_natural($build);
trick_taint($notes); trick_taint($notes);
@ -115,6 +123,10 @@ if ($action eq 'Commit'){
next; next;
} }
# Switch to the record representing this build and environment combo.
# If there is not one, it will create it and switch to that.
$caserun = $caserun->switch($build,$env);
my $status = $cgi->param('status') == -1 ? $caserun->status_id : $cgi->param('status'); my $status = $cgi->param('status') == -1 ? $caserun->status_id : $cgi->param('status');
my $assignee; my $assignee;
if ($cgi->param('assignee') eq ''){ if ($cgi->param('assignee') eq ''){

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

@ -175,23 +175,12 @@ if ($action eq 'Commit'){
} }
# Add to runs # Add to runs
my @runs; my @runs;
my $build = $cgi->param('caserun_build');
my $env = $cgi->param('caserun_env');
detaint_natural($build);
detaint_natural($env);
validate_test_id($build, 'build') if $build;
validate_test_id($env, 'environment') if $env;
foreach my $runid (split(/[\s,]+/, $cgi->param('addruns'))){ foreach my $runid (split(/[\s,]+/, $cgi->param('addruns'))){
validate_test_id($runid, 'run'); validate_test_id($runid, 'run');
push @runs, Bugzilla::Testopia::TestRun->new($runid); push @runs, Bugzilla::Testopia::TestRun->new($runid);
} }
foreach my $run (@runs){ foreach my $run (@runs){
$build ||= $run->build->id; $run->add_case_run($case->id) if $run->canedit;
$env ||= $run->environment->id;
$run->add_case_run($case->id, $build, $env) if $run->canedit;
} }
# Clone # Clone
my %planseen; my %planseen;

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

@ -339,6 +339,8 @@ sub do_update {
my $status = $cgi->param('status'); my $status = $cgi->param('status');
my $notes = $cgi->param('notes'); my $notes = $cgi->param('notes');
my $build = $cgi->param('caserun_build');
my $env = $cgi->param('caserun_env');
my $assignee; my $assignee;
if ($cgi->param('assignee')) { if ($cgi->param('assignee')) {
$assignee = login_to_id(trim($cgi->param('assignee'))); $assignee = login_to_id(trim($cgi->param('assignee')));
@ -346,16 +348,27 @@ sub do_update {
ThrowUserError("invalid_username", { name => $cgi->param('assignee') }) unless $assignee; ThrowUserError("invalid_username", { name => $cgi->param('assignee') }) unless $assignee;
ThrowUserError('testopia-missing-required-field', {field => 'Status'}) unless defined $status; ThrowUserError('testopia-missing-required-field', {field => 'Status'}) unless defined $status;
ThrowUserError('testopia-missing-required-field', {field => 'build'}) unless defined $build;
ThrowUserError('testopia-missing-required-field', {field => 'environment'}) unless defined $env;
validate_test_id($build, 'build');
validate_test_id($env, 'environment');
my @buglist; my @buglist;
foreach my $bug (split(/[\s,]+/, $cgi->param('bugs'))){ foreach my $bug (split(/[\s,]+/, $cgi->param('bugs'))){
ValidateBugID($bug); ValidateBugID($bug);
push @buglist, $bug; push @buglist, $bug;
} }
detaint_natural($env);
detaint_natural($build);
detaint_natural($status); detaint_natural($status);
trick_taint($notes); trick_taint($notes);
trick_taint($assignee); trick_taint($assignee);
# Switch to the record representing this build and environment combo.
# If there is not one, it will create it and switch to that.
$caserun = $caserun->switch($build,$env);
$caserun->set_status($status, $cgi->param('update_bug')) if ($caserun->status_id != $status); $caserun->set_status($status, $cgi->param('update_bug')) if ($caserun->status_id != $status);
$caserun->set_assignee($assignee) if ($caserun->assignee && $caserun->assignee->id != $assignee); $caserun->set_assignee($assignee) if ($caserun->assignee && $caserun->assignee->id != $assignee);
$caserun->append_note($notes) if ($notes && $caserun->notes !~ /$notes/); $caserun->append_note($notes) if ($notes && $caserun->notes !~ /$notes/);

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

@ -71,47 +71,7 @@ if ($action eq 'Commit'){
$vars->{'backlink'} = $run; $vars->{'backlink'} = $run;
display($run); display($run);
} }
elsif ($action =~ /New Case/){
print $cgi->header;
my $run = Bugzilla::Testopia::TestRun->new($run_id);
ThrowUserError("testopia-read-only", {'object' => $run}) unless $run->canedit;
my $build = $cgi->param('caserun_build');
my $env = $cgi->param('caserun_env');
detaint_natural($build);
detaint_natural($env);
validate_test_id($build, 'build');
validate_test_id($env, 'environment');
foreach my $case_id (split(/[\s,]+/, $cgi->param('newcases'))){
detaint_natural($case_id);
validate_test_id($case_id, 'case');
my $caserun = Bugzilla::Testopia::TestCaseRun->new($case_id, $run->id, $build, $env);
if ($caserun){
$vars->{'tr_error'} .= "$case_id Already Exists with that build and environment.<br>";
next;
}
else {
my $case = Bugzilla::Testopia::TestCase->new($case_id);
$caserun = Bugzilla::Testopia::TestCaseRun->new(
{case_id => $case_id,
run_id => $run->id,
build_id => $build,
environment_id => $env,
case_text_version => $case->version,
assignee => $case->default_tester->id,
});
$caserun->store;
}
}
$cgi->delete_all;
$cgi->param('run_id', $run->id);
display($run);
}
elsif ($action eq 'History'){ elsif ($action eq 'History'){
print $cgi->header; print $cgi->header;
my $run = Bugzilla::Testopia::TestRun->new($run_id); my $run = Bugzilla::Testopia::TestRun->new($run_id);
@ -230,11 +190,11 @@ elsif ($action eq 'do_clone'){
detaint_natural($s); detaint_natural($s);
} }
my $ref = $dbh->selectcol_arrayref( my $ref = $dbh->selectcol_arrayref(
"SELECT DISTINCT case_id "SELECT case_id
FROM test_case_runs FROM test_case_runs
WHERE run_id = ? WHERE run_id = ?
AND case_run_status_id IN (". join(",", @status) .")", AND case_run_status_id IN (". join(",", @status) .")
undef, $run->id); AND iscurrent = 1", undef, $run->id);
my $i = 0; my $i = 0;
my $total = scalar @$ref; my $total = scalar @$ref;