A four hour flight means another batch of changes.

1. Some UI improvements to the test display page
2. Fix process_test and the format API to properly handle editing of fields defined in formats.
3. Adjust show_test.cgi to only show recent results and the last three non-recent results. Also added a showallresults mode that allows users to view all results if they want to.
This commit is contained in:
zach%zachlipton.com 2005-08-07 03:05:49 +00:00
Родитель e39086be12
Коммит e84e0c6e5a
9 изменённых файлов: 73 добавлений и 99 удалений

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

@ -63,7 +63,7 @@ sub find_column {
}
}
# to finish the job, we need to have accessors that correspond to
# we need to have accessors that correspond to
# the "virtual columns" created by our format. sounds like a job for
# autoload...
sub AUTOLOAD {
@ -74,8 +74,7 @@ sub AUTOLOAD {
my $col = $self->find_column($name);
if (!$col) {
internalError("tried to call Litmus::DB::Test method $name which does not exist ".
"(mapped to $col)");
internalError("tried to call Litmus::DB::Test method $name which does not exist ");
}
return $self->$col(@args);
@ -124,6 +123,8 @@ sub iscompleted {
#
# Or in other words: "Heuristics are bug ridden by definition. If they didn't
# have bugs, then they'd be algorithms."
#
# XXX: Rewrite all this as an SQL query so it doesn't take so long.
memoize('state');
sub state {
my $self = shift;
@ -167,7 +168,8 @@ sub state {
# calculate the magic number for this test. In other words, the
# result spread that we require in order to have confidence in our
# result. If the spread between two states is within the magic
# number, we just return 0 and the test should be considered unrun.
# number, we just return 0 and the test should be considered unrun
# since we have no confidence in our result.
my $magicnumber = 2; # ok we don't really calculate it. We should though...
foreach my $outer (keys(%statecounts)) {

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

@ -1,54 +0,0 @@
[%# 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 Litmus.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Zach Lipton <zach@zachlipton.com>
#%]
<td valign="top" width="50%">
<strong>Steps to Perform:</strong><br>
[% IF showedit %]
<textarea name="steps_edit_[%test.testid FILTER html%]"
id="steps_edit_[%test.testid FILTER html%]"
style="display: none;"
rows="15" cols="45">[% test.steps FILTER html %]</textarea>
[% END %]
<p id="steps_text_[%test.testid FILTER html%]">
[% test.steps FILTER html_line_break | testdata %]</p>
</td>
<td valign="top" width="50%">
<strong>Expected Results:</strong><br>
[% IF showedit %]
<textarea name="results_edit_[%test.testid FILTER html%]"
id="results_edit_[%test.testid FILTER html%]"
style="display: none;"
rows="15" cols="45">[% test.expectedresults FILTER html %]</textarea>
[% END %]
<p id="results_text_[%test.testid FILTER html%]">
[% test.expectedresults FILTER html_line_break | testdata %]</p>
</td>
[% IF showedit %]
</tr>
<tr style="display: none;" id="communityenabled_row_edit_[%test.testid FILTER html%]"><td>
<strong>Community Enabled Test: </strong>
[% IF test.communityenabled %] [% checked = "checked" %] [% END %]
<input name="communityenabled_[%test.testid FILTER html%]"
type="checkbox"
id="communityenabled_[%test.testid FILTER html%]"
value="1" [% checked %]>
</td>
[% END %]

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

@ -149,29 +149,33 @@ if ($c->param("editingTestcases") && Litmus::Auth::canEdit(Litmus::Auth::getCook
@changed = split(',' => $c->param("editingTestcases"));
foreach my $editid (@changed) {
my $edittest = Litmus::DB::Test->retrieve($editid);
$edittest->summary($c->param("summary_edit_$editid"));
$edittest->steps($c->param("steps_edit_$editid"));
$edittest->expectedresults($c->param("results_edit_$editid"));
if (! $edittest) {invalidInputError("Test $editid does not exist")}
$edittest->summary($c->param("summary_edit_$editid"));
if ($c->param("communityenabled_$editid")) {
$edittest->communityenabled(1);
} else {
$edittest->communityenabled(0);
}
my $product = Litmus::DB::Product->retrieve($c->param("product_$editid"));
my $group = Litmus::DB::Testgroup->retrieve($c->param("testgroup_$editid"));
my $subgroup = Litmus::DB::Subgroup->retrieve($c->param("subgroup_$editid"));
requireField("product", $product);
requireField("group", $group);
requireField("subgroup", $subgroup);
$edittest->product($product);
$edittest->testgroup($group);
$edittest->subgroup($subgroup);
# now set the format fields:
my $format = $edittest->format();
foreach my $curfield ($format->fields()) {
warn($curfield."_edit_editid");
$edittest->set($format->getColumnMapping($curfield),
$c->param($curfield."_edit_$editid"));
}
my $product = Litmus::DB::Product->retrieve($c->param("product_$editid"));
my $group = Litmus::DB::Testgroup->retrieve($c->param("testgroup_$editid"));
my $subgroup = Litmus::DB::Subgroup->retrieve($c->param("subgroup_$editid"));
requireField("product", $product);
requireField("group", $group);
requireField("subgroup", $subgroup);
$edittest->product($product);
$edittest->testgroup($group);
$edittest->subgroup($subgroup);
$edittest->update();
}
} elsif ($c->param("editingTestcases") &&

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

@ -52,9 +52,13 @@ if (! $test) {
my @results = Litmus::DB::Result->retrieve_all();
my $showallresults = $c->param("showallresults") || "";
my $vars = {
test => $test,
results => \@results,
showallresults => $showallresults,
};
Litmus->template()->process("show/show.html.tmpl", $vars) ||

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

@ -163,13 +163,10 @@ tr#header {
/* for test lists, striped white and gray */
.testlist_odd {
background-color: #FFFFFF;
background: #FFFFFF;
}
.testlist_even {
background-color: #ABABAB;
border-color: #ADADAD;
border-style: solid;
border-width: 5px;
background: #ABABAB;
}
/* background colors based on if a group/subgroup is

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

@ -30,8 +30,8 @@
%]
[% BLOCK edittestsscript %]
var editedtests = new Array();
var fields = ["product", "summary", "steps", "results",
"testgroup", "subgroup", "communityenabled_row"];
var fields = ["product", "summary", "testgroup", "subgroup",
"communityenabled_row"];
function showEdit(testid) {
for (var i=0; i<fields.length; i++) {
show(getField(fields[i]+"_edit",testid));

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

@ -28,7 +28,7 @@
#%]
[% PROCESS global/selects.none.tmpl %]
[% script = ['subgroupscript', 'edittestsscript'] %]
[% script = ['edittestsscript'] %]
[% INCLUDE global/header.html.tmpl title = 'Run Tests' script=script includeselects=1%]
@ -49,22 +49,22 @@
<input name="isTestResult" type="hidden" value="true">
<input name="editingTestcases" id="editingTestcases" type="hidden" value="">
<input name="testgroup" type="hidden" value="[% tests.list.0.testgroup.testgroupid FILTER html %]">
<table border="0" cellpadding="5" width="100%">
[% evenodd = 'odd' %]
[% FOREACH curtest = tests %]
<tr style="testlist_[%evenodd%]"><td>
<a href="show_test.cgi?id=[% curtest.testid FILTER html %]" class="smallcaps">show</a></td></tr>
<div class="testlist_[%evenodd%]">
<a href="show_test.cgi?id=[% curtest.testid FILTER html %]" class="smallcaps">show</a>
[% INCLUDE test/test.html.tmpl test=curtest style="testlist_$evenodd" showedit=istrusted %]
<tr><td colspan="3"><hr /></td></tr>
[% IF evenodd == 'odd' %]
[% evenodd = 'even' %]
[% ELSE %]
[% evenodd = 'odd' %]
[% END %]
</div>
<hr />
[% END %]
</table>
<input type="submit" id="Submit" name="Submit" value="Submit Results" onclick="findEdited()">
</form>

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

@ -21,6 +21,8 @@
[%# INTERFACE:
# $test - the test object to display
# @results - the list of all possible test results
# $showallresults (optional) - if true, then all test results
# will be shown
#
#%]
@ -52,7 +54,20 @@
<td colspan="2">
<table border="0">
[%
# by default, we show only recent results and the last
# three non-recent results. the showallresults switch
# causes us to show all results:
%]
[% nonrecentcount = 0 %]
[% FOREACH curresult = test.testresults %]
[% UNLESS showallresults %]
[% IF curresult.isrecent == 0 && nonrecentcount >= 3 %]
[% NEXT %]
[% ELSIF curresult.isrecent == 0 %]
[% nonrecentcount = nonrecentcount+1 %]
[% END %]
[% END %]
<tr>
<td colspan="2" style="[% curresult.result.style %]">
------- Test Result From
@ -85,6 +100,7 @@
[% END %]
</table>
<a href="show_test.cgi?showallresults=1&id=[%test.testid FILTER html | uri%]">Show all results</a>
</td></tr>
</table>

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

@ -24,20 +24,16 @@
# $showedit (optional) - include UI to edit the test?
# for this to work, you must include the
# required scripts in the head
# $style (optional) - css class to apply to the table
# rows for this testcase
#
#%]
[% PROCESS global/selects.none.tmpl %]
[% IF style %] [% style = "class=\"$style\"" %] [% END %]
<tr [% style %]>
<table border="0">
<tr>
<a name="test_[% test.testid FILTER html %]" />
<td><strong>Test ID: </strong>[% test.testid FILTER html %]</td>
<td><strong>Summary: </strong>
<td width="45%">
[% IF showedit %]
<input name="summary_edit_[%test.testid FILTER html%]"
id="summary_edit_[%test.testid FILTER html%]"
@ -50,7 +46,7 @@
</strong>
</td>
<td [% style %]><table border="0">
<td><table border="0">
<tr><td><div align="right"><strong>Product:</strong></div></td>
[% IF showedit %]
@ -81,12 +77,20 @@
</table></td>
</tr>
<tr [% style %]>
<tr>
<td colspan="3">
<table border="0" cellpadding="5">
<tr id="testdatarow_[% test.testid FILTER html %]">
[% test.format.display(test, showedit, "runtests/testdisplay.html.tmpl") %]
</tr>
<tr style="display: none;" id="communityenabled_row_edit_[%test.testid FILTER html%]"><td>
<strong>Community Enabled Test: </strong>
[% IF test.communityenabled %] [% checked = "checked" %] [% END %]
<input name="communityenabled_[%test.testid FILTER html%]"
type="checkbox"
id="communityenabled_[%test.testid FILTER html%]"
value="1" [% checked %]>
</td>
</table></td>
</tr>
</td>
@ -106,10 +110,10 @@
</td>
</tr>
[% END %]
<tr [% style %]>
<tr>
<td colspan="3"><hr /></td>
</tr>
<tr [% style %]>
<tr>
<td valign="top">
<p><strong>Result:</strong></p>
<table border="0">
@ -130,4 +134,5 @@
name="testnote_[% test.testid FILTER html %]" cols="45" rows="4" wrap="soft"
id="note"></textarea>
</td>
</tr>
</tr>
</table>