зеркало из https://github.com/mozilla/pjs.git
Synching with rev 2546
This commit is contained in:
Родитель
951efe72f9
Коммит
9d436ad9d5
|
@ -160,8 +160,8 @@ sub remove {
|
|||
|
||||
=head2 check_name
|
||||
|
||||
Returns true if a category of the specified name exists in the
|
||||
database for a product.
|
||||
Returns the category id if the specified name exists in the
|
||||
database for the product.
|
||||
|
||||
=cut
|
||||
|
||||
|
@ -170,7 +170,7 @@ sub check_name {
|
|||
my ($name) = @_;
|
||||
my $dbh = Bugzilla->dbh;
|
||||
my $is = $dbh->selectrow_array(
|
||||
"SELECT 1 FROM test_case_categories
|
||||
"SELECT category_id FROM test_case_categories
|
||||
WHERE name = ? AND product_id = ?",
|
||||
undef, $name, $self->{'product_id'});
|
||||
|
||||
|
|
|
@ -246,6 +246,11 @@ sub parse()
|
|||
my $category_name = entity_replace_xml($twig_category->field('name'),STRIP_BOTH);
|
||||
my $product_name = entity_replace_xml($twig_category->att('product'),STRIP_BOTH);
|
||||
my $description = entity_replace_xml($twig_category->field('description'),STRIP_BOTH);
|
||||
if ( $category_name eq "" )
|
||||
{
|
||||
$self->error("Category name cannot be empty, product='" . $product_name . "', description='" . $description . "'.");
|
||||
next;
|
||||
}
|
||||
|
||||
$description = "FIX ME. Created during category import with no description supplied." if ( $description eq "" );
|
||||
|
||||
|
@ -466,7 +471,15 @@ sub parse()
|
|||
# Keep track of this testcase's category. To create a category at this time would require
|
||||
# getting the product from the Test Plan that this Test Case is associated with. The category
|
||||
# will created when each Test Case is stored.
|
||||
$xml_testcase->category(entity_replace_xml($twig_testcase->field('categoryname'),STRIP_BOTH));
|
||||
my $categoryname = entity_replace_xml($twig_testcase->field('categoryname'),STRIP_BOTH);
|
||||
if ( $categoryname ne "" )
|
||||
{
|
||||
$xml_testcase->category($categoryname);
|
||||
}
|
||||
else
|
||||
{
|
||||
$self->error("Empty category name for test case '" . $summary . "'.");
|
||||
}
|
||||
|
||||
my @attachments = $twig_testcase->children('attachment');
|
||||
foreach my $twig_attachments (@attachments)
|
||||
|
|
|
@ -316,18 +316,9 @@ sub store()
|
|||
# exist it will be created.
|
||||
foreach my $testplan (@testplan)
|
||||
{
|
||||
my $categoryid = -1;
|
||||
|
||||
push my @categories, @{$testplan->product->categories};
|
||||
foreach my $category (@categories)
|
||||
{
|
||||
if ( $category->name eq $self->category )
|
||||
{
|
||||
$categoryid = $category->id;
|
||||
last;
|
||||
}
|
||||
}
|
||||
if ( $categoryid == -1 )
|
||||
my $category = $testplan->product->categories->[0];
|
||||
my $categoryid = $category->check_name($self->category) if ( defined($category) );
|
||||
if ( ! defined($categoryid) )
|
||||
{
|
||||
my $new_category = Bugzilla::Testopia::Category->new({
|
||||
product_id => $testplan->product_id,
|
||||
|
|
|
@ -94,16 +94,29 @@ sub create
|
|||
{
|
||||
my $self =shift;
|
||||
my ($new_values) = @_;
|
||||
|
||||
if (not defined $$new_values{plan_id})
|
||||
{
|
||||
die "Plan ID Number (plan_id) Required When Creating A TestCase"
|
||||
}
|
||||
|
||||
# Plan id linked to new test case after store method is called
|
||||
my $plan_id = $$new_values{plan_id};
|
||||
|
||||
# Remove plan id from new_values hash
|
||||
delete $$new_values{plan_id};
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_case = new Bugzilla::Testopia::TestCase($new_values);
|
||||
|
||||
# Result is test plan id
|
||||
my $result = $test_case->store();
|
||||
|
||||
$test_case->link_plan($plan_id, $result);
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result is new test plan id
|
||||
return $result
|
||||
}
|
||||
|
||||
|
@ -121,7 +134,7 @@ sub update
|
|||
$self->logout;
|
||||
die "Testcase, " . $test_case_id . ", not found";
|
||||
}
|
||||
|
||||
|
||||
if (not $test_case->canedit)
|
||||
{
|
||||
$self->logout;
|
||||
|
@ -312,6 +325,110 @@ sub get_components
|
|||
return $result;
|
||||
}
|
||||
|
||||
sub add_tag
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_case_id, $tag_name) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_case = new Bugzilla::Testopia::TestCase($test_case_id);
|
||||
|
||||
if (not defined $test_case)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testcase, " . $test_case_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_case->canedit)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
#Create new tag or retrieve id of existing tag
|
||||
my $test_tag = new Bugzilla::Testopia::TestTag({tag_name=>$tag_name});
|
||||
my $tag_id = $test_tag->store;
|
||||
|
||||
my $result = $test_case->add_tag($tag_id);
|
||||
|
||||
if ($result == 1)
|
||||
{
|
||||
$self->logout;
|
||||
die "Tag, " . $tag_name . ", already exists for Testcase, " . $test_case_id;
|
||||
}
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result 0 on success, otherwise an exception will be thrown
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub remove_tag
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_case_id, $tag_name) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_case = new Bugzilla::Testopia::TestCase($test_case_id);
|
||||
|
||||
if (not defined $test_case)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testcase, " . $test_case_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_case->canedit)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
my $test_tag = Bugzilla::Testopia::TestTag->check_name($tag_name);
|
||||
if (not defined $test_tag)
|
||||
{
|
||||
$self->logout;
|
||||
die "Tag, " . $tag_name . ", does not exist";
|
||||
}
|
||||
|
||||
my $result = $test_case->remove_tag($test_tag->id);
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result 0 on success, otherwise an exception will be thrown
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub get_tags
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_case_id) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_case = new Bugzilla::Testopia::TestCase($test_case_id);
|
||||
|
||||
if (not defined $test_case)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testcase, " . $test_case_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_case->canview)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
my $result = $test_case->tags;
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result list of tags otherwise an exception will be thrown
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub lookup_status_id_by_name
|
||||
{
|
||||
my $self =shift;
|
||||
|
@ -423,4 +540,73 @@ sub lookup_priority_name_by_id
|
|||
return $result;
|
||||
}
|
||||
|
||||
sub link_plan
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_case_id, $test_plan_id) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_case = new Bugzilla::Testopia::TestCase($test_case_id);
|
||||
|
||||
if (not defined $test_case)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testcase, " . $test_case_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_case->canedit)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
$test_case->link_plan($test_plan_id);
|
||||
|
||||
my $result = $test_case->plans;
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result is list of plans for test case on success, otherwise an exception will be thrown
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub unlink_plan
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_case_id, $test_plan_id) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_case = new Bugzilla::Testopia::TestCase($test_case_id);
|
||||
|
||||
if (not defined $test_case)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testcase, " . $test_case_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_case->canedit)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
my $rtn_code = $test_case->unlink_plan($test_plan_id);
|
||||
|
||||
if ($rtn_code == 0)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Can Not Unlink Plan, " . $test_plan_id;
|
||||
}
|
||||
|
||||
my $result = $test_case->plans;
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result is list of plans for test case on success, otherwise an exception will be thrown
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
1;
|
|
@ -228,6 +228,35 @@ sub get_categories
|
|||
return $result;
|
||||
}
|
||||
|
||||
sub get_components
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_plan_id) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id);
|
||||
|
||||
if (not defined $test_plan)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testplan, " . $test_plan_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_plan->canview)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
my $result = $test_plan->product->components;
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result is list of components for the given test plan
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub get_builds
|
||||
{
|
||||
my $self =shift;
|
||||
|
@ -296,4 +325,108 @@ sub lookup_type_id_by_name
|
|||
return $result;
|
||||
}
|
||||
|
||||
sub add_tag
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_plan_id, $tag_name) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id);
|
||||
|
||||
if (not defined $test_plan)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testplan, " . $test_plan_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_plan->canedit)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
#Create new tag or retrieve id of existing tag
|
||||
my $test_tag = new Bugzilla::Testopia::TestTag({tag_name=>$tag_name});
|
||||
my $tag_id = $test_tag->store;
|
||||
|
||||
my $result = $test_plan->add_tag($tag_id);
|
||||
|
||||
if ($result == 1)
|
||||
{
|
||||
$self->logout;
|
||||
die "Tag, " . $tag_name . ", already exists for Testplan, " . $test_plan_id;
|
||||
}
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result 0 on success, otherwise an exception will be thrown
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub remove_tag
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_plan_id, $tag_name) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id);
|
||||
|
||||
if (not defined $test_plan)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testplan, " . $test_plan_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_plan->canedit)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
my $test_tag = Bugzilla::Testopia::TestTag->check_name($tag_name);
|
||||
if (not defined $test_tag)
|
||||
{
|
||||
$self->logout;
|
||||
die "Tag, " . $tag_name . ", does not exist";
|
||||
}
|
||||
|
||||
my $result = $test_plan->remove_tag($test_tag->id);
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result 0 on success, otherwise an exception will be thrown
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub get_tags
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_plan_id) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_plan = new Bugzilla::Testopia::TestPlan($test_plan_id);
|
||||
|
||||
if (not defined $test_plan)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testplan, " . $test_plan_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_plan->canview)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
my $result = $test_plan->tags;
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result list of tags otherwise an exception will be thrown
|
||||
return $result;
|
||||
}
|
||||
|
||||
1;
|
|
@ -265,4 +265,108 @@ sub lookup_environment_name_by_id
|
|||
return $result;
|
||||
}
|
||||
|
||||
sub add_tag
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_run_id, $tag_name) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_run = new Bugzilla::Testopia::TestRun($test_run_id);
|
||||
|
||||
if (not defined $test_run)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testrun, " . $test_run_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_run->canedit)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
#Create new tag or retrieve id of existing tag
|
||||
my $test_tag = new Bugzilla::Testopia::TestTag({tag_name=>$tag_name});
|
||||
my $tag_id = $test_tag->store;
|
||||
|
||||
my $result = $test_run->add_tag($tag_id);
|
||||
|
||||
if ($result == 1)
|
||||
{
|
||||
$self->logout;
|
||||
die "Tag, " . $tag_name . ", already exists for Testrun, " . $test_run_id;
|
||||
}
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result 0 on success, otherwise an exception will be thrown
|
||||
return $result;
|
||||
}
|
||||
|
||||
sub remove_tag
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_run_id, $tag_name) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_run = new Bugzilla::Testopia::TestRun($test_run_id);
|
||||
|
||||
if (not defined $test_run)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testrun, " . $test_run_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_run->canedit)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
my $test_tag = Bugzilla::Testopia::TestTag->check_name($tag_name);
|
||||
if (not defined $test_tag)
|
||||
{
|
||||
$self->logout;
|
||||
die "Tag, " . $tag_name . ", does not exist";
|
||||
}
|
||||
|
||||
my $result = $test_run->remove_tag($test_tag->id);
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result 0 on success, otherwise an exception will be thrown
|
||||
return 0;
|
||||
}
|
||||
|
||||
sub get_tags
|
||||
{
|
||||
my $self =shift;
|
||||
my ($test_run_id) = @_;
|
||||
|
||||
$self->login;
|
||||
|
||||
my $test_run = new Bugzilla::Testopia::TestRun($test_run_id);
|
||||
|
||||
if (not defined $test_run)
|
||||
{
|
||||
$self->logout;
|
||||
die "Testrun, " . $test_run_id . ", not found";
|
||||
}
|
||||
|
||||
if (not $test_run->canview)
|
||||
{
|
||||
$self->logout;
|
||||
die "User Not Authorized";
|
||||
}
|
||||
|
||||
my $result = $test_run->tags;
|
||||
|
||||
$self->logout;
|
||||
|
||||
# Result list of tags otherwise an exception will be thrown
|
||||
return $result;
|
||||
}
|
||||
|
||||
1;
|
|
@ -158,7 +158,7 @@ found.</b>
|
|||
</tr>
|
||||
|
||||
<tr>
|
||||
[% IF NOT multiprod %]
|
||||
[% IF NOT multiprod AND NOT addrun %]
|
||||
<td align="right"><b>Category<b></td>
|
||||
<td>
|
||||
[% PROCESS select sel = { name => 'category',
|
||||
|
@ -208,7 +208,7 @@ found.</b>
|
|||
<div class="links">
|
||||
<span class="label">Export:</span>
|
||||
<a href="tr_list_cases.cgi?[% urlquerypart FILTER remove('&viewall=.') FILTER html %]&ctype=csv&viewall=1"><image src="testopia/img/csv.png" class="image"></a>
|
||||
|
|
||||
<img src="https://secure-www.novell.com/img/link_divbar.gif" width="1" height="20" alt="line" class="bar">
|
||||
<a href="tr_list_cases.cgi?[% urlquerypart FILTER remove('&viewall=.') FILTER html %]&ctype=xml&viewall=1"><image src="testopia/img/xml.png" class="image"></a>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
<testcase author="[% case.author.email FILTER xml %]" priority="[% case.priority FILTER xml %]" automated="[% case.isautomated ? "Automatic" : "Manual" FILTER xml %]" status="[% case.status FILTER xml %]">
|
||||
[% IF case.text.action %]
|
||||
<action>[% case.text.action FILTER xml %]</action>
|
||||
<action>[% case.text.action FILTER replace('<','&testopia_lt;') FILTER replace('>','&testopia_gt;') %]</action>
|
||||
[% END %]
|
||||
[% IF case.alias %]
|
||||
<alias>[% case.alias FILTER xml %]</alias>
|
||||
|
@ -32,21 +32,17 @@
|
|||
[% IF case.arguments %]
|
||||
<arguments>[% case.arguments FILTER xml %]</arguments>
|
||||
[% END %]
|
||||
[% IF case.blocked %]
|
||||
[% FOREACH blocked_test_case = case.blocked %]
|
||||
[% FOREACH blocked_test_case = case.blocked %]
|
||||
<blocks type="Xml_description">[% blocked_test_case.summary FILTER xml %]</blocks>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% IF case.text.breakdown %]
|
||||
<breakdown>[% case.text.breakdown FILTER xml %]</breakdown>
|
||||
<breakdown>[% case.text.breakdown FILTER replace('<','&testopia_lt;') FILTER replace('>','&testopia_gt;') %]</breakdown>
|
||||
[% END %]
|
||||
[% IF case.category.name %]
|
||||
<categoryname>[% case.category.name FILTER xml %]</categoryname>
|
||||
[% END %]
|
||||
[% IF case.components %]
|
||||
[% FOREACH component = case.components %]
|
||||
[% FOREACH component = case.components %]
|
||||
<component product="[% component.product_name %]">[% component.name FILTER xml %]</component>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% IF case.default_tester.email %]
|
||||
<defaulttester>[% case.default_tester.email FILTER xml %]</defaulttester>
|
||||
|
@ -57,7 +53,7 @@
|
|||
[% END %]
|
||||
[% END %]
|
||||
[% IF case.text.effect %]
|
||||
<expectedresults>[% case.text.effect FILTER xml %]</expectedresults>
|
||||
<expectedresults>[% case.text.effect FILTER replace('<','&testopia_lt;') FILTER replace('>','&testopia_gt;') %]</expectedresults>
|
||||
[% END %]
|
||||
[% IF case.requirement %]
|
||||
<requirement>[% case.requirement FILTER xml %]</requirement>
|
||||
|
@ -66,20 +62,16 @@
|
|||
<script>[% case.script FILTER xml %]</script>
|
||||
[% END %]
|
||||
[% IF case.text.setup %]
|
||||
<setup>[% case.text.setup FILTER xml %]</setup>
|
||||
<setup>[% case.text.setup FILTER replace('<','&testopia_lt;') FILTER replace('>','&testopia_gt;') %]</setup>
|
||||
[% END %]
|
||||
[% IF case.summary %]
|
||||
<summary>[% case.summary FILTER xml %]</summary>
|
||||
[% END %]
|
||||
[% IF case.tags %]
|
||||
[% FOREACH tag = case.tags %]
|
||||
[% FOREACH tag = case.tags %]
|
||||
<tag>[% tag.name FILTER xml %]</tag>
|
||||
[% END %]
|
||||
[% END %]
|
||||
[% IF case.plans %]
|
||||
[% FOREACH test_plan = case.plans %]
|
||||
[% FOREACH test_plan = case.plans %]
|
||||
<testplan_reference type="Xml_description">[% test_plan.name FILTER xml %]</testplan_reference>
|
||||
[% END %]
|
||||
[% END %]
|
||||
</testcase>
|
||||
|
|
@ -21,5 +21,8 @@
|
|||
[%# Testopia XML export header template #%]
|
||||
|
||||
<?xml version="1.0" [% IF Param('utf8') %]encoding="UTF-8" [% END %]standalone="yes" ?>
|
||||
<!DOCTYPE testopia SYSTEM "testopia.dtd">
|
||||
<!DOCTYPE testopia SYSTEM "testopia.dtd" [
|
||||
<!ENTITY testopia_lt "<">
|
||||
<!ENTITY testopia_gt ">">
|
||||
]>
|
||||
<testopia version="1.1">
|
|
@ -176,7 +176,7 @@
|
|||
|
||||
[% table.list_count FILTER none %] test cases found.
|
||||
<br/>
|
||||
<form action="tr_list_cases.cgi" method="GET">
|
||||
<form action="tr_list_cases.cgi" method="POST">
|
||||
<input type="hidden" name="exclude" value="[% run.case_id_list FILTER none %]" />
|
||||
<input type="hidden" name="current_tab" value="case" />
|
||||
<input type="hidden" name="addrun" value="[% run.id FILTER none %]" />
|
||||
|
|
|
@ -393,9 +393,9 @@ Index: /bmo-2.22/Bugzilla/DB/Schema.pm
|
|||
+ component_id => {TYPE => 'INT2', NOTNULL => 1},
|
||||
+ ],
|
||||
+ INDEXES => [
|
||||
+ case_components_case_id_idx => ['case_id'],
|
||||
+ case_commponents_component_id_idx => ['component_id'],
|
||||
+ ],
|
||||
+ components_case_id_idx => {FIELDS => [qw(case_id component_id)],
|
||||
+ TYPE => 'UNIQUE'},
|
||||
+ components_component_id_idx => ['component_id'],+ ],
|
||||
+ },
|
||||
+
|
||||
+ test_run_activity => {
|
||||
|
|
|
@ -394,9 +394,9 @@ Index: /bmo-2.22/Bugzilla/DB/Schema.pm
|
|||
+ component_id => {TYPE => 'INT2', NOTNULL => 1},
|
||||
+ ],
|
||||
+ INDEXES => [
|
||||
+ case_components_case_id_idx => ['case_id'],
|
||||
+ case_commponents_component_id_idx => ['component_id'],
|
||||
+ ],
|
||||
+ components_case_id_idx => {FIELDS => [qw(case_id component_id)],
|
||||
+ TYPE => 'UNIQUE'},
|
||||
+ components_component_id_idx => ['component_id'],+ ],
|
||||
+ },
|
||||
+
|
||||
+ test_run_activity => {
|
||||
|
|
|
@ -122,9 +122,13 @@ sub peek(*)
|
|||
# In each field need to change '\"' to '"' and change all '"' to '""'. The last field
|
||||
# will also have a '"' at the end of the line that needs to be removed.
|
||||
#
|
||||
sub print_tcdb_fields
|
||||
# If TCDB format the Test Case Name may contain a series of 4-6 digits after two underscores
|
||||
# which need to be removed. The TCDB appended the Test Case number to any Test Case created
|
||||
# from a existing Test Case. In Testopia the Test Case numbers have no meaning.
|
||||
#
|
||||
sub print_fields
|
||||
{
|
||||
my ($file_descriptor,$fields_ref,$testcasenamefield) = @_;
|
||||
my ($file_descriptor,$fields_ref,$testcasenamefield,$tcdb_format) = @_;
|
||||
|
||||
my $index = 0;
|
||||
while ( $index < @$fields_ref )
|
||||
|
@ -132,7 +136,7 @@ sub print_tcdb_fields
|
|||
$fields_ref->[$index] =~ s/"$//g if ( $index == ( @$fields_ref -1 ) );
|
||||
$fields_ref->[$index] =~ s/\\"/"/g;
|
||||
$fields_ref->[$index] =~ s/"/""/g;
|
||||
if ( $index == $testcasenamefield )
|
||||
if ( $tcdb_format && ( $index == $testcasenamefield ) )
|
||||
{
|
||||
$fields_ref->[$index] =~ s/__\d\d\d\d\d\d\d//g;
|
||||
$fields_ref->[$index] =~ s/__\d\d\d\d\d\d//g;
|
||||
|
@ -179,19 +183,23 @@ sub remove_field_list
|
|||
chop;
|
||||
|
||||
s/\r//g;
|
||||
s/\342\200\231/’/g;
|
||||
s/\342\200\230/‘/g;
|
||||
s/\342\200\246/…/g;
|
||||
#
|
||||
# Map extended characters into HTML entities.
|
||||
#
|
||||
s/\342\200\223/-/g;
|
||||
s/\342\200\224/—/g;
|
||||
s/\342\200\230/‘/g;
|
||||
s/\342\200\231/’/g;
|
||||
s/\342\200\234/“/g;
|
||||
s/\342\200\235/”/g;
|
||||
s/\342\200\246/…/g;
|
||||
s/\302\240/ /g;
|
||||
s/\302\251/©/g;
|
||||
s/\031/'/g;
|
||||
s/\221/&8216;/g; # left single quotation mark
|
||||
s/\222/&8217;/g; # right single quotation mark
|
||||
s/\223/&8220;/g; # left double quotation mark
|
||||
s/\224/&8221;/g; # right double quotation mark
|
||||
s/\223/&8220;/g; # left double quotation mark
|
||||
s/\224/&8221;/g; # right double quotation mark
|
||||
s/\226/-/g;
|
||||
s/\337/ß/g; # beta
|
||||
s/\341/à/g; # small letter a with acute accent
|
||||
|
@ -248,7 +256,7 @@ sub remove_field_list
|
|||
|
||||
# The end of the TCDB CSV line will be a double quote at the end of the line. Keep combining
|
||||
# lines until we have a double quote at the end of the line and try to parse the line.
|
||||
if ( ! ($parse_line =~ /.+"$/) )
|
||||
if ( ! ($parse_line =~ /.+\n*"$/) )
|
||||
{
|
||||
$parse_line .= "\\n";
|
||||
next;
|
||||
|
@ -301,8 +309,8 @@ sub remove_field_list
|
|||
}
|
||||
# Is the next non-white space character a comma followed by a double quote? If yes then we
|
||||
# have reached the end of the field.
|
||||
if ( ( $comma_index <= $#chars && $chars[$comma_index] eq "," ) &&
|
||||
( $double_quote_index <= $#chars && $chars[$double_quote_index] eq "\"" ) )
|
||||
if ( ( $comma_index <= $#chars && $chars[$comma_index] eq "," ) &&
|
||||
( $double_quote_index <= $#chars && $chars[$double_quote_index] eq "\"" ) )
|
||||
{
|
||||
push (@fields,join("",@field_buffer));
|
||||
@field_buffer = ();
|
||||
|
@ -354,7 +362,7 @@ sub remove_field_list
|
|||
# Do we have all the fields we need?
|
||||
if ( ($#fields == ($number_of_fields-1)) && (! $in_quote_field) && $looks_like_end_of_csv_line )
|
||||
{
|
||||
print_tcdb_fields(\*CSVWORK,\@fields,$testcasenamefield);
|
||||
print_fields(\*CSVWORK,\@fields,$testcasenamefield,$tcdb_format);
|
||||
$parse_line = "";
|
||||
@fields = ();
|
||||
}
|
||||
|
@ -369,7 +377,7 @@ sub remove_field_list
|
|||
# Create the missing field. Need to insert a double quote since print_fields expects a double
|
||||
# quote at end of last field.
|
||||
push (@fields,"\"");
|
||||
print_tcdb_fields(\*CSVWORK,\@fields,$testcasenamefield);
|
||||
print_fields(\*CSVWORK,\@fields,$testcasenamefield,$tcdb_format);
|
||||
$parse_line = "";
|
||||
@fields = ();
|
||||
}
|
||||
|
@ -447,16 +455,17 @@ my $csv_work_filename = $csv_input_filename . ".work";
|
|||
open(XMLOUTPUT, ">", $xml_output_filename) or error("Cannot open file $xml_output_filename");
|
||||
my %tcdb_user;
|
||||
my $field_list = remove_field_list($csv_input_filename,$csv_work_filename,$tcdb);
|
||||
map_TCDB_users(\%tcdb_user);
|
||||
map_TCDB_users(\%tcdb_user) if ( $tcdb );
|
||||
|
||||
#
|
||||
# Process the $field_list variable which comes from the first line of the CSV file.
|
||||
# Process the $field_list variable which comes from the first line of the CSV file. This line
|
||||
# defines the columns and column order of the CSV file.
|
||||
#
|
||||
# Format of the first line should be in the form:
|
||||
# "Testcase Name","Attributes","Priority","Description","Folder","Creator","Owner",
|
||||
# "Pass/Fail Definition","Setup Steps","Cleanup Steps","Steps"
|
||||
#
|
||||
# Fields currently used if they exist are:
|
||||
# Columns currently used if they exist are:
|
||||
# attributes - split apart at each comma to become a tag.
|
||||
# category - category for test case.
|
||||
# cleanupsteps - added to Break Down section.
|
||||
|
@ -479,21 +488,39 @@ map_TCDB_users(\%tcdb_user);
|
|||
# is the summary. if testcasename and description are both null a error is
|
||||
# generated. added to Action section if -tcdb flag used.
|
||||
#
|
||||
# The order of the fields is not important. The fields supplied to Class::CSV will be in
|
||||
# The order of the columns is not important. The columns supplied to Class::CSV will be in
|
||||
# order found on the first line of the CSV file.
|
||||
#
|
||||
# The field_list returned from remove_field_list() will have:
|
||||
# Changed to lower case.
|
||||
# Remove spaces.
|
||||
# Remove all "s.
|
||||
# Remove all /s.
|
||||
# The field_list returned from remove_field_list() will have been:
|
||||
# Transformed to lower case.
|
||||
# All white space characters removed.
|
||||
# All double quotes (") removed.
|
||||
# All forward slashes (/) removed.
|
||||
#
|
||||
|
||||
# More sources for the CSV's other than TCDB, transform some of the column names.
|
||||
$field_list =~ s/author/owner/g;
|
||||
$field_list =~ s/result/passfaildefinition/g;
|
||||
$field_list =~ s/summary/testcasename/g;
|
||||
$field_list =~ s/tags/attributes/g;
|
||||
# Column name mapping. $field_list contains the name of each column in the CSV file. If your
|
||||
# column name is that same as a default column name you can covert the column name in $field_list
|
||||
# and no additional code is needed for the field.
|
||||
#
|
||||
# For example if you have a column named 'author' that is really the 'owner' of the Test Case you
|
||||
# just change 'author' to 'owner' in $field_list.
|
||||
#
|
||||
# Add , to front and end of $field_list to make substitution logic easier. They are remove when
|
||||
# substitutions are finished.
|
||||
$field_list = ",$field_list,";
|
||||
# author is mapped to owner
|
||||
$field_list =~ s/,author,/,owner,/g;
|
||||
# result is mapped to passfaildefinition
|
||||
$field_list =~ s/,result,/,passfaildefinition,/g;
|
||||
# summary is mapped to testcasename
|
||||
$field_list =~ s/,summary,/,testcasename,/g;
|
||||
# tags is mapped to attributes
|
||||
$field_list =~ s/,tags,/,attributes,/g;
|
||||
# remove , from beginning of $field_list
|
||||
$field_list =~ s/^,//;
|
||||
# remove , from end of $field_list
|
||||
$field_list =~ s/,$//;
|
||||
|
||||
my %fields;
|
||||
foreach my $field ( split(/,/,$field_list) )
|
||||
{
|
||||
|
@ -534,7 +561,7 @@ foreach my $line (@{$csv->lines()}) {
|
|||
|
||||
error("No owner for Test Case at line $line_count in $csv_work_filename") if ( ! defined($fields{'owner'}) );
|
||||
my $owner = $line->owner();
|
||||
$owner = $tcdb_user{$line->owner()} if ( $owner =~ /\d+/ );
|
||||
$owner = $tcdb_user{$line->owner()} if ( $tcdb );
|
||||
error("Could not find owner for Test Case at line $line_count in $csv_work_filename") if ( $owner eq "" );
|
||||
|
||||
print XMLOUTPUT "author=\"" . fix_entities($owner) . "\" ";
|
||||
|
|
|
@ -353,6 +353,9 @@ sub UpdateDB {
|
|||
$dbh->bz_alter_column('test_runs', 'run_id', {TYPE => 'INTSERIAL', PRIMARYKEY => 1, NOTNULL => 1});
|
||||
$dbh->bz_alter_column('test_runs', 'start_date', {TYPE => 'DATETIME', NOTNULL => 1});
|
||||
|
||||
$dbh->bz_drop_index('test_case_components', 'case_commponents_component_id_idx');
|
||||
$dbh->bz_drop_index('test_case_components', 'case_components_case_id_idx');
|
||||
$dbh->bz_drop_index('test_case_components', 'case_components_component_id_idx');
|
||||
$dbh->bz_drop_index('test_case_run_status', 'AI_case_run_status_id');
|
||||
$dbh->bz_drop_index('test_case_run_status', 'sortkey');
|
||||
$dbh->bz_drop_index('test_cases', 'AI_case_id');
|
||||
|
@ -369,9 +372,11 @@ sub UpdateDB {
|
|||
$dbh->bz_add_index('test_builds', 'build_name_idx', ['name']);
|
||||
$dbh->bz_add_index('test_builds', 'build_product_id_name_idx', {FIELDS => [qw(product_id name)], TYPE => 'UNIQUE'});
|
||||
$dbh->bz_add_index('test_case_categories', 'category_product_id_name_idx', {FIELDS => [qw(product_id name)], TYPE => 'UNIQUE'});
|
||||
$dbh->bz_add_index('test_case_components', 'components_case_id_idx', {FIELDS => [qw(case_id component_id)], TYPE => 'UNIQUE'});
|
||||
$dbh->bz_add_index('test_case_components', 'components_component_id_idx', ['component_id']);
|
||||
$dbh->bz_add_index('test_case_runs', 'case_run_build_env_idx', {FIELDS => [qw(run_id case_id build_id environment_id)], TYPE => 'UNIQUE'});
|
||||
$dbh->bz_add_index('test_case_tags', 'case_tags_user_idx', [qw(tag_id userid)]);
|
||||
$dbh->bz_add_index('test_cases', 'test_case_requirement_idx', ['requirement']);
|
||||
$dbh->bz_add_index('test_case_tags', 'case_tags_user_idx', [qw(tag_id userid)]);
|
||||
$dbh->bz_add_index('test_runs', 'test_run_plan_id_run_id_idx', [qw(plan_id run_id)]);
|
||||
$dbh->bz_add_index('test_runs', 'test_runs_summary_idx', {FIELDS => ['summary'], TYPE => 'FULLTEXT'});
|
||||
|
||||
|
|
|
@ -257,7 +257,7 @@ if ($table->view_count > $query_limit){
|
|||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit});
|
||||
}
|
||||
# Check that all of the test cases returned only belong to one product.
|
||||
if ($table->list_count > 0 && $table->list_count < 1000 && !$cgi->param('addrun')){
|
||||
if ($table->list_count > 0 && !$cgi->param('addrun')){
|
||||
my %case_prods;
|
||||
my $prod_id;
|
||||
foreach my $case (@{$table->list}){
|
||||
|
|
Загрузка…
Ссылка в новой задаче