This commit is contained in:
ghendricks%novell.com 2008-03-06 23:56:52 +00:00
Родитель b947010226
Коммит 059762b5a9
4 изменённых файлов: 620 добавлений и 205 удалений

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

@ -163,7 +163,7 @@ sub check_case_category {
"SELECT category_id FROM test_case_categories "SELECT category_id FROM test_case_categories
WHERE name = ? AND product_id = ?", WHERE name = ? AND product_id = ?",
undef, $name, $product->id); undef, $name, $product->id);
ThrowUserError('invalid-test-id-non-existent', {type => 'Case Category', id => $name}) unless $is;
return $is; return $is;
} }

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

@ -60,7 +60,7 @@ use base qw(Exporter Bugzilla::Object);
############################### ###############################
use constant DB_TABLE => "test_cases"; use constant DB_TABLE => "test_cases";
use constant NAME_FIELD => "summary"; use constant NAME_FIELD => "alias";
use constant ID_FIELD => "case_id"; use constant ID_FIELD => "case_id";
use constant DB_COLUMNS => qw( use constant DB_COLUMNS => qw(
case_id case_id
@ -167,16 +167,19 @@ sub _check_status{
} }
sub _check_category{ sub _check_category{
my ($invocant, $category) = @_; my ($invocant, $category, $product) = @_;
if (ref $invocant){
$product = $invocant->product;
}
$category = trim($category); $category = trim($category);
my $category_id; my $category_id;
if ($category =~ /^\d+$/){ if ($category =~ /^\d+$/){
$category_id = Bugzilla::Testopia::Util::validate_selection($category, 'category_id', 'test_case_categories'); $category_id = Bugzilla::Testopia::Util::validate_selection($category, 'category_id', 'test_case_categories');
} }
else { else {
$category_id = lookup_category_by_name($category); $category_id = Bugzilla::Testopia::Category::check_case_category($category, $product->id)->id;
} }
ThrowUserError('invalid_category') unless $category_id;
return $category_id; return $category_id;
} }
@ -428,6 +431,9 @@ sub new {
bless($param, $class); bless($param, $class);
return $param; return $param;
} }
if (!defined $param || (!ref($param) && $param !~ /^\d+$/)) {
$param = { name => $param };
}
unshift @_, $param; unshift @_, $param;
my $self = $class->SUPER::new(@_); my $self = $class->SUPER::new(@_);
@ -512,6 +518,16 @@ sub update {
$dbh->bz_unlock_tables(); $dbh->bz_unlock_tables();
} }
sub run_create_validators {
my $class = shift;
my $params = $class->SUPER::run_create_validators(@_);
my $product = $params->{plans}->[0]->product;
$params->{category_id} = $class->_check_gategory($params->{category}, $product);
return $params;
}
############################### ###############################
#### Functions #### #### Functions ####
############################### ###############################

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

@ -63,7 +63,7 @@ sub check_build {
ThrowUserError('testopia-read-only', {'object' => $product}) unless $product->canedit; ThrowUserError('testopia-read-only', {'object' => $product}) unless $product->canedit;
return Bugzilla::Testopia::Build->new(check_build($name, $product)); return Bugzilla::Testopia::Build->new(Bugzilla::Testopia::Build::check_build($name, $product));
} }
sub create{ sub create{
@ -143,8 +143,7 @@ sub update{
} }
# DEPRECATED use Build::get instead # DEPRECATED use Build::get instead
sub lookup_name_by_id sub lookup_name_by_id {
{
my $self = shift; my $self = shift;
my ($build_id) = @_; my ($build_id) = @_;
@ -163,12 +162,8 @@ sub lookup_name_by_id
} }
# DEPRECATED use Build::check_build($name, $product) instead # DEPRECATED use Build::check_build($name, $product) instead
sub lookup_id_by_name sub lookup_id_by_name {
{ return { FAILED => 1, message => 'This method is considered harmful and has been depricated. Please use Build::check_build instead'};
my $self = shift;
my ($name) = @_;
return { FAILED => 1, message => 'This method is considered harmful and has been depricated. Please use check_build instead'};
} }
1; 1;
@ -226,7 +221,7 @@ Provides methods for automated scripts to manipulate Testopia Builds
Returns: Hash/Array: In the case of a single build it is returned. If a Returns: Hash/Array: In the case of a single build it is returned. If a
list was passed, it returns an array of build hashes. If the list was passed, it returns an array of build hashes. If the
update on any particular build failed, the has will contain a update on any particular build failed, the hash will contain a
FAILED key and the message as to why it failed. FAILED key and the message as to why it failed.
=item C<create($values)> =item C<create($values)>
@ -250,7 +245,6 @@ Provides methods for automated scripts to manipulate Testopia Builds
=over =over
L<Bugzilla::Testopia::Build> L<Bugzilla::Testopia::Build>
L<Bugzilla::Webservice> L<Bugzilla::Webservice>
=back =back

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

@ -22,21 +22,27 @@ use strict;
use Bugzilla::User; use Bugzilla::User;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Testopia::TestCase; use Bugzilla::Testopia::TestCase;
use Bugzilla::Testopia::Category;
use Bugzilla::Testopia::Search; use Bugzilla::Testopia::Search;
use Bugzilla::Testopia::Table; use Bugzilla::Testopia::Table;
use base qw(Bugzilla::WebService); use base qw(Bugzilla::WebService);
sub _validate { sub _process_list {
my ($case) = @_; my ($ids) = @_;
Bugzilla->login(LOGIN_REQUIRED);
$case = Bugzilla::Testopia::TestCase->new($case);
ThrowUserError('invalid-test-id-non-existent', {type => 'Case', id => $id}) unless $case; my @ids;
ThrowUserError('testopia-permission-denied', {'object' => $case}) unless $case->canedit; if (ref $ids eq 'ARRAY'){
@ids = @$ids;
return $case; }
elsif ($ids =~ /,/){
@ids = split(/[\s,]+/, $ids);
}
else {
push @ids, $ids;
}
return @ids;
} }
sub get { sub get {
@ -77,7 +83,7 @@ sub list {
} }
sub create { sub create {
my $self =shift; my $self = shift;
my ($new_values) = @_; my ($new_values) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
@ -126,21 +132,12 @@ sub create {
sub update { sub update {
my $self =shift; my $self = shift;
my ($ids, $new_values) = @_; my ($ids, $new_values) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
my @ids; my @ids = _process_list($ids);
if (ref $ids eq 'ARRAY'){
@ids = @$ids;
}
elsif ($ids =~ /,/){
@ids = split(/[\s,]+/, $ids);
}
else {
push @ids, $ids;
}
my @cases; my @cases;
foreach my $id (@ids){ foreach my $id (@ids){
@ -185,7 +182,7 @@ sub update {
} }
sub get_text { sub get_text {
my $self =shift; my $self = shift;
my ($case_id, $version) = @_; my ($case_id, $version) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
@ -200,7 +197,7 @@ sub get_text {
} }
sub store_text { sub store_text {
my $self =shift; my $self = shift;
my ($case_id, $author_id, $action, $effect, $setup, $breakdown) = @_; my ($case_id, $author_id, $action, $effect, $setup, $breakdown) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
@ -231,24 +228,36 @@ sub get_plans {
} }
sub attach_bug { sub attach_bug {
my $self =shift; my $self = shift;
my ($case_id, $bugids) = @_; my ($case_ids, $bug_ids) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
my $case = new Bugzilla::Testopia::TestCase($case_id); my @ids = _process_list($case_ids);
my @results;
ThrowUserError('invalid-test-id-non-existent', {type => 'Test Case', id => $case_id}) unless $case; foreach my $id (@ids){
ThrowUserError('testopia-read-only', {'object' => $case}) unless $case->canedit; my $case = new Bugzilla::Testopia::TestCase($id);
unless ($case){
$case->attach_bugs($bugids); push @results, {FAILED => 1, message => "TestCase $id does not exist"};
next;
# Result 0 on success, otherwise an exception will be thrown }
return 0; unless ($case->canedit){
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
next;
}
eval {
$case->attach_bug($bug_ids);
}
if ($@){
push @results, {FAILED => 1, message => $@};
}
}
# @results will be empty if successful
return @results;
} }
sub detach_bug { sub detach_bug {
my $self =shift; my $self = shift;
my ($case_id, $bugids) = @_; my ($case_id, $bugids) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
@ -280,23 +289,36 @@ sub get_bugs {
} }
sub add_component { sub add_component {
my $self =shift; my $self = shift;
my ($case_id, $component_id) = @_; my ($case_ids, $component_ids) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
my $case = new Bugzilla::Testopia::TestCase($case_id); my @ids = _process_list($case_ids);
my @results;
ThrowUserError('invalid-test-id-non-existent', {type => 'Test Case', id => $case_id}) unless $case; foreach my $id (@ids){
ThrowUserError('testopia-read-only', {'object' => $case}) unless $case->canedit; my $case = new Bugzilla::Testopia::TestCase($id);
unless ($case){
$case->add_component($component_id); push @results, {FAILED => 1, message => "TestCase $id does not exist"};
# Result 0 on success, otherwise an exception will be thrown next;
return 0; }
unless ($case->canedit){
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
next;
}
eval {
$case->add_component($component_ids);
}
if ($@){
push @results, {FAILED => 1, message => $@};
}
}
# @results will be empty if successful
return @results;
} }
sub remove_component { sub remove_component {
my $self =shift; my $self = shift;
my ($case_id, $component_id) = @_; my ($case_id, $component_id) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
@ -313,7 +335,7 @@ sub remove_component {
} }
sub get_components { sub get_components {
my $self =shift; my $self = shift;
my ($case_id) = @_; my ($case_id) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
@ -328,24 +350,36 @@ sub get_components {
} }
sub add_tag { sub add_tag {
my $self =shift; my $self = shift;
my ($case_id, $tag_name) = @_; my ($case_ids, $tags) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
my $case = new Bugzilla::Testopia::TestCase($case_id); my @ids = _process_list($case_ids);
my @results;
ThrowUserError('invalid-test-id-non-existent', {type => 'Test Case', id => $case_id}) unless $case; foreach my $id (@ids){
ThrowUserError('testopia-read-only', {'object' => $case}) unless $case->canedit; my $case = new Bugzilla::Testopia::TestCase($id);
unless ($case){
$case->add_tag($tag_name); push @results, {FAILED => 1, message => "TestCase $id does not exist"};
next;
# Result 0 on success, otherwise an exception will be thrown }
return 0; unless ($case->canedit){
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
next;
}
eval {
$case->add_tag($tags);
}
if ($@){
push @results, {FAILED => 1, message => $@};
}
}
# @results will be empty if successful
return @results;
} }
sub remove_tag { sub remove_tag {
my $self =shift; my $self = shift;
my ($case_id, $tag_name) = @_; my ($case_id, $tag_name) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
@ -362,7 +396,7 @@ sub remove_tag {
} }
sub get_tags { sub get_tags {
my $self =shift; my $self = shift;
my ($case_id) = @_; my ($case_id) = @_;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
@ -376,20 +410,204 @@ sub get_tags {
return $case->tags; return $case->tags;
} }
sub check_category {
my ($name, $product) = @_;
Bugzilla->login(LOGIN_REQUIRED);
if (ref $product){
$product = $product;
}
elsif ($product =~ /^\d+$/){
$product = Bugzilla::Testopia::Product->new($product);
}
else {
$product = Bugzilla::Product::check_product($product);
$product = Bugzilla::Testopia::Product->new($product->id);
}
ThrowUserError('testopia-read-only', {'object' => $product}) unless $product->canedit;
return Bugzilla::Testopia::Category->new(check_case_category($name, $product));
}
sub link_plan {
my $self = shift;
my ($case_ids, $test_plan_id) = @_;
Bugzilla->login(LOGIN_REQUIRED);
my @ids = _process_list($case_ids);
my @results;
foreach my $id (@ids){
my $case = new Bugzilla::Testopia::TestCase($id);
unless ($case){
push @results, {FAILED => 1, message => "TestCase $id does not exist"};
next;
}
unless ($case->canedit){
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
next;
}
eval {
$case->link_plan($test_plan_id);
}
if ($@){
push @results, {FAILED => 1, message => $@};
}
}
# Result is list of plans for test case on success, otherwise an exception will be thrown
return @results;
}
sub unlink_plan {
my $self = shift;
my ($case_id, $test_plan_id) = @_;
Bugzilla->login(LOGIN_REQUIRED);
my $case = new Bugzilla::Testopia::TestCase($case_id);
ThrowUserError('invalid-test-id-non-existent', {type => 'Test Case', id => $case_id}) unless $case;
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless ($case->can_unlink_plan($plan_id));
$case->unlink_plan($test_plan_id);
# Result is list of plans for test case on success, otherwise an exception will be thrown
return $case->plans;
}
sub add_to_run {
my $self = shift;
my ($case_ids, $run_ids) = @_;
Bugzilla->login(LOGIN_REQUIRED);
my @ids = _process_list($case_ids);
my @results;
foreach my $id (@ids){
my $case = new Bugzilla::Testopia::TestCase($id);
unless ($case){
push @results, {FAILED => 1, message => "TestCase $id does not exist"};
next;
}
unless ($case->canedit){
push @results, {FAILED => 1, message => "You do not have rights to edit this test case"};
next;
}
eval {
$case->add_to_run($run_ids);
}
if ($@){
push @results, {FAILED => 1, message => $@};
}
}
# @results will be empty if successful
return @results;
}
sub get_case_run_history {
my $self = shift;
my ($case_id) = @_;
Bugzilla->login(LOGIN_REQUIRED);
my $case = new Bugzilla::Testopia::TestCase($case_id);
ThrowUserError('invalid-test-id-non-existent', {type => 'Test Case', id => $case_id}) unless $case;
ThrowUserError('testopia-permission-denied', {'object' => $case}) unless $case->canview;
# Result list of caseruns otherwise an exception will be thrown
return $case->caseruns;
}
sub get_change_history {
my $self = shift;
my ($case_id) = @_;
Bugzilla->login(LOGIN_REQUIRED);
my $case = new Bugzilla::Testopia::TestCase($case_id);
ThrowUserError('invalid-test-id-non-existent', {type => 'Test Case', id => $case_id}) unless $case;
ThrowUserError('testopia-permission-denied', {'object' => $case}) unless $case->canview;
# Result list of changes otherwise an exception will be thrown
return $case->history;
}
sub calculate_average_time {
my $self = shift;
my ($case_id) = @_;
Bugzilla->login(LOGIN_REQUIRED);
my $case = new Bugzilla::Testopia::TestCase($case_id);
ThrowUserError('invalid-test-id-non-existent', {type => 'Test Case', id => $case_id}) unless $case;
ThrowUserError('testopia-permission-denied', {'object' => $case}) unless $case->canview;
return $case->calculate_average_time;
}
sub lookup_category_id_by_name {
return { FAILED => 1, message => 'This method is considered harmful and has been depricated. Please use TestCase::check_catagory instead'};
}
sub lookup_category_name_by_id {
my $self = shift;
my ($id) = @_;
Bugzilla->login(LOGIN_REQUIRED);
my $result = lookup_category($id);
if (!defined $result){
$result = 0;
};
# Result is test case category name for the given test case category id
return $result;
}
sub lookup_priority_id_by_name {
my $self = shift;
my ($name) = @_;
Bugzilla->login(LOGIN_REQUIRED);
# Result is test case priority id for the given test case priority name
return lookup_priority_by_value($name);
}
sub lookup_priority_name_by_id {
my $self = shift;
my ($id) = @_;
Bugzilla->login(LOGIN_REQUIRED);
my $result = lookup_priority($id);
if (!defined $result) {
$result = 0;
};
# Result is test case priority name for the given test case priority id
return $result;
}
sub lookup_status_id_by_name { sub lookup_status_id_by_name {
my $self =shift; my $self = shift;
my ($name) = @_; my ($name) = @_;
$self->login; $self->login;
my $result = lookup_status_by_name($name);
# Result is test case status id for the given test case status name # Result is test case status id for the given test case status name
return $result; return lookup_status_by_name($name);
} }
sub lookup_status_name_by_id { sub lookup_status_name_by_id {
my $self =shift; my $self = shift;
my ($id) = @_; my ($id) = @_;
$self->login; $self->login;
@ -405,100 +623,6 @@ sub lookup_status_name_by_id {
return $result; return $result;
} }
sub lookup_category_id_by_name {
my $self =shift;
my ($name) = @_;
$self->login;
my $result = lookup_category_by_name($name);
# Result is test case category id for the given test case category name
return $result;
}
sub lookup_category_name_by_id {
my $self =shift;
my ($id) = @_;
$self->login;
my $result = lookup_category($id);
if (!defined $result){
$result = 0;
};
# Result is test case category name for the given test case category id
return $result;
}
sub lookup_priority_id_by_name {
my $self =shift;
my ($name) = @_;
$self->login;
my $result = lookup_priority_by_value($name);
# Result is test case priority id for the given test case priority name
return $result;
}
sub lookup_priority_name_by_id {
my $self =shift;
my ($id) = @_;
$self->login;
my $result = lookup_priority($id);
if (!defined $result) {
$result = 0;
};
# Result is test case priority name for the given test case priority id
return $result;
}
sub link_plan {
my $self =shift;
my ($case_id, $test_plan_id) = @_;
Bugzilla->login(LOGIN_REQUIRED);
my $case = new Bugzilla::Testopia::TestCase($case_id);
ThrowUserError('invalid-test-id-non-existent', {type => 'Test Case', id => $case_id}) unless $case;
ThrowUserError('testopia-read-only', {'object' => $case}) unless $case->canedit;
$case->link_plan($test_plan_id);
# Result is list of plans for test case on success, otherwise an exception will be thrown
return $case->plans;
}
sub unlink_plan {
my $self =shift;
my ($case_id, $test_plan_id) = @_;
Bugzilla->login(LOGIN_REQUIRED);
my $case = new Bugzilla::Testopia::TestCase($case_id);
ThrowUserError('invalid-test-id-non-existent', {type => 'Test Case', id => $case_id}) unless $case;
ThrowUserError('testopia-read-only', {'object' => $case}) unless $case->canedit;
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless ($case->can_unlink_plan($plan_id));
# Result is list of plans for test case on success, otherwise an exception will be thrown
return $case->plans;
}
sub add_to_run {}
sub get_case_run_history {}
sub get_change_history {}
sub calculate_average_time {}
1; 1;
__END__ __END__
@ -519,35 +643,331 @@ Provides methods for automated scripts to manipulate Testopia TestCases
=over =over
=item C<get($id)> =item C<add_component($case_ids, $component_ids)>
Description: Used to load an existing build from the database. Description: Adds one or more components to the selected test cases.
Params: $id - An integer representing the ID in the database Params: $case_ids - Integer/Array/String: An integer or alias representing the ID in the database,
an arry of case_ids or aliases, or a string of comma separated case_ids.
$component_ids - Integer/Array/String - The component ID, an array of Component IDs,
or a comma separated list of component IDs
Returns: undef/Array: undef on success or an array of hashes with failure
codes if a failure occured.
=item C<add_tag($case_ids, $tags)>
Description: Add one or more tags to the selected test cases.
Params: $case_ids - Integer/Array/String: An integer or alias representing the ID in the database,
an arry of case_ids or aliases, or a string of comma separated case_ids.
$tags - String/Array - A single tag, an array of tags,
or a comma separated list of tags.
Returns: undef/Array: undef on success or an array of hashes with failure
codes if a failure occured.
=item C<add_to_run($case_ids, $run_ids)>
Description: Add one or more cases to the selected test runs.
Params: $case_ids - Integer/Array/String: An integer or alias representing the ID in the database,
an arry of case_ids or aliases, or a string of comma separated case_ids.
$run_ids - Integer/Array/String: An integer representing the ID in the database
an array of IDs, or a comma separated list of IDs.
Returns: undef/Array: undef on success or an array of hashes with failure
codes if a failure occured.
=item C<attach_bug($case_ids, $bug_ids)>
Description: Add one or more bugs to the selected test cases.
Params: $case_ids - Integer/Array/String: An integer or alias representing the ID in the database,
an array of case_ids or aliases, or a string of comma separated case_ids.
$bug_ids - Integer/Array/String: An integer or alias representing the ID in the database,
an array of bug_ids or aliases, or a string of comma separated bug_ids.
Returns: undef/Array: undef on success or an array of hashes with failure
codes if a failure occured.
=item C<calculate_average_time($case_id)>
Description: Returns an average time for completion accross all runs.
Params: $case_id - Integer/String: An integer or alias representing the ID in the database.
Returns: String: Time in "HH:MM:SS" format.
=item C<check_category($name, $product)>
Description: Looks up and returns a category by name.
Params: $name - String: name of the category.
$product - Integer/String/Object
Integer: product_id of the product in the Database
String: Product name
Object: Blessed Bugzilla::Product object
Returns: Hash: Matching Category object hash or error if not found.
=item C<create($values)>
Description: Creates a new Test Case object and stores it in the database.
Params: $values - Hash: A reference to a hash with keys and values
matching the fields of the test case to be created.
Returns: The newly created object hash.
=item C<detach_bug($case_id, $bug_id)>
Description: Remove a bug from a test case.
Params: $case_id - Integer/String: An integer or alias representing the ID in the database.
$bug_ids - Integer/Array/String: An integer or alias representing the ID in the database,
an array of bug_ids or aliases, or a string of comma separated bug_ids.
Returns: 0 on success.
=item C<get($case_id)>
Description: Used to load an existing test case from the database.
Params: $id - Integer/String: An integer representing the ID in the database
or a string representing the unique alias for this case.
Returns: A blessed Bugzilla::Testopia::TestCase object hash Returns: A blessed Bugzilla::Testopia::TestCase object hash
=item C<check_build($name, $product)> =item C<get_bugs($case_id)>
Description: Get the list of bugs that are associated with this test case.
Description: Looks up and returns a build by name. Params: $case_id - Integer/String: An integer representing the ID in the database
or a string representing the unique alias for this case.
Returns: Array: An array of bug object hashes.
=item C<get_case_run_history($case_id)>
Description: Get the list of case-runs for all runs this case appears in.
To limit this list by build or other attribute, see TestCaseRun::list.
Params: $case_id - Integer/String: An integer representing the ID in the database
or a string representing the unique alias for this case.
Returns: Array: An array of case-run object hashes.
=item C<get_case_run_history($case_id)>
Description: Get the list of changes to the fields of this case.
Params: $case_id - Integer/String: An integer representing the ID in the database
or a string representing the unique alias for this case.
Returns: Array: An array of hashes with changed fields and their details.
=item C<get_components($case_id)>
Description: Get the list of components attached to this case.
Params: $case_id - Integer/String: An integer representing the ID in the database
or a string representing the unique alias for this case.
Returns: Array: An array of component object hashes.
=item C<get_plans($case_id)>
Description: Get the list of plans that this case is linked to.
Params: $case_id - Integer/String: An integer representing the ID in the database
or a string representing the unique alias for this case.
Returns: Array: An array of test plan object hashes.
=item C<get_tags($case_id)>
Description: Get the list of tags attached to this case.
Params: $case_id - Integer/String: An integer representing the ID in the database
or a string representing the unique alias for this case.
Returns: Array: An array of tag object hashes.
=item C<get_text($case_id, $version)>
Description: The associated large text fields: Action, Expected Results, Setup, Breakdown
for a given version.
Params: $case_id - Integer/String: An integer representing the ID in the database
or a string representing the unique alias for this case.
Params: $name - String: name of the build. $version - Integer: (OPTIONAL) The version of the text you want returned.
$product - Integer/String/Object Defaults to the latest.
Integer: product_id of the product in the Database
String: Product name Returns: Hash: Text fields and values.
Object: Blessed Bugzilla::Product object
Returns: Hash: Matching TestCase object hash or error if not found. =item C<link_plan($case_ids, $plan_id)>
Description: Link test cases to the given plan.
Params: $case_ids - Integer/Array/String: An integer or alias representing the ID in the database,
an array of case_ids or aliases, or a string of comma separated case_ids.
$plan_id - Integer: An integer or alias representing the ID in the database.
Returns: undef/Hash: undef on success, hash of failures if not.
=item C<list($query)>
Description: Performs a search and returns the resulting list of test cases.
Params: $query - Hash: keys must match valid search fields.
+--------------------------------------------------------+
| Case Search Parameters |
+--------------------------------------------------------+
| Key | Valid Values |
| andor | 1: Author AND tester, 0: OR |
| author | A bugzilla login (email address) |
| author_type | (select from email_variants) |
| case_id | comma separated integers |
| default_tester | A bugzilla login (email address) |
| default_tester_type | (select from email_variants) |
| plan_id | comma separated integers |
| priority | String: Priority |
| product | String: Product Name |
| requirement | String: Requirement |
| requirement_type | (select from query_variants) |
| run_id | comma separated integers |
| script | String |
| script_type | (select from query_variants) |
| summary | String |
| summary_type | (select from query_variants) |
| tags | String |
| tags_type | (select from tag_variants) |
| tcaction | String |
| tcaction_type | (select from query_variants) |
| tceffect | String |
| tceffect_type | (select from query_variants) |
+--------------------------------------------------------+
+---------------------------------------------------+
| Paging and Sorting |
+---------------------------------------------------+
| Key | Description |
| dir | "ASC" or "DESC" |
| order | field to sort by |
+---------------------------------------------------+
| page_size | integer: how many per page |
| page | integer: page number |
| +++++++ OR +++++++ |
| start | integer: Start with which record |
| limit | integer: limit to how many |
+---------------------------------------------------+
| viewall | 1: returns all records |
+---------------------------------------------------+
+----------------------------------------------------+
| query_variants |
+----------------+-----------------------------------+
| Key | Description |
| allwordssubstr | contains all of the words/strings |
| anywordssubstr | contains any of the words/strings |
| substring | contains the string |
| casesubstring | contains the string (exact case) |
| allwords | contains all of the words |
| anywords | contains any of the words |
| regexp | matches the regexp |
| notregexp | doesn't match the regexp |
+----------------+-----------------------------------+
+-------------------------------------+
| email_variants |
+--------------+----------------------+
| Key | Description |
| substring | contains |
| exact | is |
| regexp | matches regexp |
| notregexp | doesn't match regexp |
+--------------+----------------------+
+----------------------------------------------------+
| tag_variants |
+----------------+-----------------------------------+
| Key | Description |
| anyexact | is tagged with |
| allwordssubstr | contains all of the words/strings |
| anywordssubstr | contains any of the words/strings |
| substring | contains the string |
| casesubstring | contains the string (exact case) |
| regexp | matches the regexp |
| notregexp | doesn't match the regexp |
| allwords | contains all of the words |
| anywords | contains any of the words |
| nowords | contains none of the words |
+----------------------------------------------------+
Returns: Array: Matching test cases are retuned in a list of hashes.
=item C<lookup_category_name_by_id> B<DEPRICATED> Use TestCase::get instead
=item C<lookup_category_id_by_name> B<DEPRICATED - CONSIDERED HARMFUL> Use TestCase::check_build instead
=item C<lookup_priority_name_by_id> B<DEPRICATED> Use TestCase::get instead
=item C<lookup_priority_id_by_name> B<DEPRICATED - CONSIDERED HARMFUL> Use TestCase::check_build instead
=item C<lookup_status_name_by_id> B<DEPRICATED> Use TestCase::get instead
=item C<lookup_status_id_by_name> B<DEPRICATED - CONSIDERED HARMFUL> Use TestCase::check_build instead
=item C<remove_component($case_id, $component_id)>
Description: Removes selected component from the selected test case.
Params: $case_id - Integer/String: An integer or alias representing the ID in the database.
$component_id - Integer: - The component ID to be removed.
Returns: 0 on success.
=item C<remove_tag($case_id, $tag)>
Description: Remove a tag from a case.
Params: $case_id - Integer/String: An integer or alias representing the ID in the database.
$tag - String - A single tag to be removed.
Returns: 0 on success.
=item C<unlink_plan($case_id, $plan_id)>
Description: Unlink a test case from the given plan. If only one plan is linked, this will delete
the test case.
Params: $case_ids - Integer/String: An integer or alias representing the ID in the database.
$plan_id - Integer: An integer representing the ID in the database.
Returns: undef/Array: Array of plans still linked if any, undef if not.
=item C<update($ids, $values)> =item C<update($ids, $values)>
Description: Updates the fields of the selected build or builds. Description: Updates the fields of the selected build or builds.
Params: $ids - Integer/String/Array Params: $ids - Integer/String/Array
Integer: A single build ID. Integer: A single TestCase ID.
String: A comma separates string of TestCase IDs for batch String: A comma separates string of TestCase IDs for batch
processing. processing.
Array: An array of build IDs for batch mode processing Array: An array of case IDs for batch mode processing
$values - Hash of keys matching TestCase fields and the new values $values - Hash of keys matching TestCase fields and the new values
to set each field to. to set each field to.
@ -556,21 +976,7 @@ Provides methods for automated scripts to manipulate Testopia TestCases
list was passed, it returns an array of build hashes. If the list was passed, it returns an array of build hashes. If the
update on any particular build failed, the has will contain a update on any particular build failed, the has will contain a
FAILED key and the message as to why it failed. FAILED key and the message as to why it failed.
=item C<create($values)>
Description: Creates a new build object and stores it in the database
Params: $values - Hash: A reference to a hash with keys and values
matching the fields of the build to be created.
See Bugzilla::Testopia::TestCase for a list of required fields.
Returns: The newly created object hash.
=item C<lookup_name_by_id> B<DEPRICATED> Use TestCase::get instead
=item C<lookup_id_by_name> B<DEPRICATED - CONSIDERED HARMFUL> Use TestCase::check_build instead
=back =back
=head1 SEE ALSO =head1 SEE ALSO
@ -578,7 +984,6 @@ Provides methods for automated scripts to manipulate Testopia TestCases
=over =over
L<Bugzilla::Testopia::TestCase> L<Bugzilla::Testopia::TestCase>
L<Bugzilla::Webservice> L<Bugzilla::Webservice>
=back =back