Testopia:Documentation:XMLRPC:TestCase: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
No edit summary
(Replacing page with ' see http://landfill.bugzilla.org/testopia2/docs/html/api/Bugzilla/WebService/Testopia/TestCase.html')
 
Line 1: Line 1:
__NOEDITSECTION__
  see http://landfill.bugzilla.org/testopia2/docs/html/api/Bugzilla/WebService/Testopia/TestCase.html
Back to [[Testopia:Documentation:XMLRPC |Testopia XML-RPC API]]
 
==TestCase==
 
===Description===
Each test case must be linked to one or more test plans.
 
===Hiearchy===
Bugzilla::WebService::Testopia::TestCase
 
===Attributes===
 
{| border=1 cellpadding=4
| '''Attribute''' || '''Data Type''' || '''Comments''' || '''Create''' || '''Read''' || '''Update'''
|-
| alias || string || || Optional || X || X
|-
| arguments || string || || Optional || X || X
|-
| author_id || integer || || Required || X ||
|-
| canview || integer || || || X ||
|-
| case_id || integer || || || X ||
|-
| case_status_id || integer || || Required || X || X
|-
| category_id || integer || || Required || X || X
|-
| creation_date || string || Format: yyyy-mm-dd hh:mm:ss || || X ||
|-
| default_tester_id || integer || || Optional || X ||
|-
| isautomated || integer || || Required || X || X
|-
| plans || Array of TestPlan hashmaps || || || X ||
|-
| priority_id || integer || || Optional || X || X
|-
| requirement || string || || Optional || X || X
|-
| script || string || || Optional || X || X
|-
| summary || string || || Required || X || X
|-
| sortkey || integer || || Optional || X || X
|-
| estimated_time || string || Format: hh:mm:ss || Optional || X || X
|-
|}
 
 
===Methods===
 
----
====get - Get A TestCase by ID====
----
 
=====Usage=====
TestCase.get
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer || Must be greater than 0.
|-
|}
 
 
=====Result=====
A hash map of key/value pairs for the attributes listed above or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Perl</b>
my $case_id = 1;
my $result = $proxy->call('TestCase.get', $case_id);
 
----
====list - Get A List of TestCases Based on A Query====
----
 
=====Usage=====
TestCase.list
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| query<sup>1</sup> || hashmap || Can not be null. See [[Bugzilla_XML-RPC_API_Query_Examples |Query Examples]].
|-
|}
 
<sup>1</sup>Other attributes available for use with query include: run_id
 
 
=====Result=====
An array of TestCase hash maps or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Java</b>
ArrayList<Object> params = new ArrayList<Object>();
params.add(testCase_id);
Object[] result = (Object[]) client.execute("TestCase.list_components", params);
 
<b>Perl</b>
my $result = $proxy->('TestCase.list', {case_id => 1});
 
----
====create - Create A New TestCase====
----
 
=====Usage=====
TestCase.create
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| new_values || hashmap || See required attributes list<sup>1</sup> below.
|-
|}
 
<sup>1</sup> Required attributes: author_id, case_status_id, category_id, isautomated, and plan_id.
 
 
=====Result=====
An integer value representing the new case_id or a hash map containing values for the keys, "faultcode" and "faultstring".
 
 
=====Example=====
<b>Java</b>
ArrayList<Object> params = new ArrayList<Object>();
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("arguments","");
map.put("case_status_id", "2"); //Can be Proposed (1), Disabled (3), Confirmed (2)
map.put("summary",summary);
map.put("script", script);
map.put("category","General");
map.put("isautomated","1");
map.put("category_id", category_id);
map.put("testedby", author_id);
map.put("author_id", author_id);
map.put("priority_id",priority_id);
map.put("plan_id", plan_id);
params.add(map);
Integer result = (Integer)client.execute("TestCase.create", params);
 
<b>Perl</b>
my $result = $proxy->call('TestCase.create', {summary => 'Summary', plan_id => 1, author_id => 1, isautomated => 0, category_id => 1, case_status_id => 2});
 
 
 
----
====update - Update An Existing TestCase====
----
 
=====Usage=====
TestCase.update
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
| new_values || hashmap || author_id and case_id can not be modified.
|-
|}
 
 
=====Result=====
The modified TestCase on success or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Perl</b>
my $result = $proxy->call('TestCase.create', {summary => 'Summary', isautomated => 0, category_id => 1, case_status_id => 2,
                                              alias => 'Alias', arguments => 'Arguments', default_tester_id => 1,
                                              priority_id => 1, script => 'Script',  sortkey => 100,
                                              estimated_time => '12:12:12'});
 
 
 
----
====get_text - Get TestCase's Current Action/Effect Document====
----
 
=====Usage=====
TestCase.get_text
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
|}
 
 
=====Result=====
A hash map of key/value pairs for the attributes of a TestCase document or a hash map containing values for the keys, "faultcode" and "faultstring".
 
Attributes of a TestCase document are action, author, effect, and version.
 
=====Example=====
<b>Perl</b>
my $case_id = 1;
my $result = $proxy->call("TestCase.get_text", $case_id);
 
----
====store_text - Add A New TestCase Action/Effect Document====
----
 
=====Usage=====
TestCase.store_text
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
| author_id || integer ||
|-
| action || string ||
|-
| effect || string ||
|-
| setup || string ||
|-
| breakdown || string ||
|-
|}
 
 
=====Result=====
The new document version on success or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Perl</b>
my $case_id = 1;
my $author_id = 1;
my $action = "New Action";
my $effect = "New Effect";
my $setup  = "New Setup";
my $breakdown = "New Breakdown";
my $result = $proxy->call("TestCase.store_text", $case_id, $author_id, $action, $effect, $setup, $breakdown);
 
----
====get_bugs - Get a list of bugs for the given TestCase====
----
 
=====Usage=====
TestCase.get_bugs
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
|}
 
 
=====Result=====
An array of Bug hash maps or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Perl</b>
my $case_id;
my $result = $proxy->call("TestCase.get_bugs", $case_id);
 
----
====add_component - Add a component to the given TestCase====
----
 
=====Usage=====
TestCase.add_component
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
| component_id || integer ||
|-
|}
 
 
=====Result=====
The integer , 0, on success or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Java</b>
ArrayList<Object> params = new ArrayList<Object>();
params.add(testCase_id);
params.add(component_id);
Integer result = (Integer)client.execute("TestCase.add_component", params);
 
<b>Perl</b>
my $case_id = 1;
my $component_id = 1;
my $result = $proxy->call('TestCase.add_component', $case_id, $component_id);
 
----
====remove_component - Remove a component from the given TestCase====
----
 
=====Usage=====
TestCase.remove_component
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
| component_id || integer ||
|-
|}
 
 
=====Result=====
The integer , 0, on success or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Perl</b>
my $case_id = 1;
my $component_id = 1;
my $result = $proxy->call('TestCase.remove_component', $case_id, $component_id);
 
 
----
====get_components - Get a list of components for the given TestCase====
----
 
=====Usage=====
TestCase.get_components
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
|}
 
 
=====Result=====
An array of Component hash maps or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Perl</b>
my $case_id = 1;
my $result = $proxy->call("TestCase.get_components", $case_id);
 
 
----
====add_tag - Add a tag to the given TestCase====
----
 
=====Usage=====
TestCase.add_tag
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
| tag_name || string || Creates tag if it does not exist
|-
|}
 
 
=====Result=====
The integer , 0, on success or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Java</b>
ArrayList<Object> params = new ArrayList<Object>();
params.add(testCase_id);
params.add(tag_name);
Integer result = (Integer)client.execute("TestCase.add_tag", params);
 
<b>Perl</b>
my $case_id = 1;
my $tag_name = "Tag Name to Add";
my $result = $proxy->call("TestCase.add_tag", $case_id, $tag_name);
 
 
----
====remove_tag - Remove a tag from the given TestCase====
----
 
=====Usage=====
TestCase.remove_tag
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
| tag_name || string ||
|-
|}
 
 
=====Result=====
The integer , 0, on success or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Perl</b>
my $case_id = 1;
my $tag_name = "Tag Name to Remove";
my $result = $proxy->call("TestCase.remove_tag", $case_id, $tag_name);
 
 
----
====get_tags - Get a list of tags for the given TestCase====
----
 
=====Usage=====
TestCase.get_tags
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
|}
 
 
=====Result=====
An array of Tag hash maps or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Perl</b>
my $case_id = 1;
my $result = $proxy->call("TestCase.get_tags", $case_id);
 
 
----
====get_plans - Get a list of TestPlans for the given TestCase====
----
 
=====Usage=====
TestCase.get_plans
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
|}
 
 
=====Result=====
An array of TestPlan hash maps or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Perl</b>
my $case_id = 1;
my $result = $proxy->call("TestCase.get_plans", $case_id);
 
 
----
====lookup_category_id_by_name - Lookup A TestCase Category ID By Its Name====
----
 
=====Usage=====
TestCase.lookup_category_id_by_name
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| name || string || Cannot be null or empty string
|-
|}
 
 
=====Result=====
The TestCase category id for the respective name or 0 if an error occurs.
 
=====Example=====
<b>Perl</b>
my $category_name = 'Name';
my $result = $proxy->call('TestCase.lookup_category_id_by_name', $category_name);
 
 
 
----
====lookup_category_name_by_id - Lookup A TestCase Category Name By Its ID====
----
 
=====Usage=====
TestCase.lookup_category_name_by_id
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| id || integer || Cannot be 0
|-
|}
 
 
=====Result=====
The TestCase category name for the respective id or empty string if an error occurs.
 
=====Example=====
<b>Perl</b>
my $category_id = 1;
my $result = $proxy->call('TestCase.lookup_category_name_by_id', $category_id);
 
 
 
----
====lookup_priority_id_by_name - Lookup A TestCase Priority ID By Its Name====
----
 
=====Usage=====
TestCase.lookup_priority_id_by_name
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| name || string || Cannot be null or empty string
|-
|}
 
 
=====Result=====
The TestCase priority id for the respective name or 0 if an error occurs.
 
=====Example=====
<b>Perl</b>
my $priority_name = 'Name';
my $result = $proxy->call('TestCase.lookup_priority_id_by_name', $priority_name);
 
<b>Java</b>
ArrayList<Object> params = new ArrayList<Object>();
params.add(priority_name);
Integer result = (Integer)client.execute("TestCase.lookup_priority_id_by_name", params);
 
----
====lookup_priority_name_by_id - Lookup A TestCase Priority Name By Its ID====
----
 
=====Usage=====
TestCase.lookup_priority_name_by_id
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| id || integer || Cannot be 0
|-
|}
 
 
=====Result=====
The TestCase priority name for the respective id or empty string if an error occurs.
 
=====Example=====
<b>Perl</b>
my $priority_id = 1;
my $result = $proxy->call('TestCase.lookup_priority_name_by_id', $priority_id);
 
<b>Java</b>
ArrayList<Object> params = new ArrayList<Object>();
params.add(priority_id);
Integer result = (Integer)client.execute("TestCase.lookup_priority_name_by_id", params);
 
----
====lookup_status_id_by_name - Lookup A TestCase Status ID By Its Name====
----
 
=====Usage=====
TestCase.lookup_status_id_by_name
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| name || string || Cannot be null or empty string
|-
|}
 
 
=====Result=====
The TestCase status id for the respective name or 0 if an error occurs.
 
=====Example=====
<b>Perl</b>
my $status_name = 'Name';
my $result = $proxy->call('TestCase.lookup_status_id_by_name', $status_name);
 
 
 
----
====lookup_status_name_by_id - Lookup A TestCase Status Name By Its ID====
----
 
=====Usage=====
TestCase.lookup_status_name_by_id
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| id || integer || Cannot be 0
|-
|}
 
 
=====Result=====
The TestCase status name for the respective id or empty string if an error occurs.
 
=====Example=====
<b>Perl</b>
my $status_id = 1;
my $result = $proxy->call('TestCase.lookup_status_name_by_id', $status_id);
 
 
 
----
====link_plan - Link A TestPlan To An Existing TestCase====
----
 
=====Usage=====
TestCase.link_plan
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
| plan_id || integer ||
|}
 
 
=====Result=====
An array of TestPlan hash maps or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Perl</b>
my $case_id = 1;
my $plan_id = 1;
my $result = $proxy->call('TestCase.link_plan', $case_id, $plan_id);
 
 
----
====unlink_plan - Unlink A TestPlan From An Existing TestCase====
----
 
=====Usage=====
TestCase.unlink_plan
 
=====Parameters=====
{| border=1 cellpadding=4
| '''Parameter''' || '''Data Type''' || '''Comments'''
|-
| case_id || integer ||
|-
| plan_id || integer ||
|}
 
 
=====Result=====
An array of TestPlan hash maps or a hash map containing values for the keys, "faultcode" and "faultstring".
 
=====Example=====
<b>Perl</b>
my $case_id = 1;
my $plan_id = 1;
my $result = $proxy->call('TestCase.unlink_plan', $case_id, $plan_id);
 
 
<br>Back to the [[Testopia |Testopia Main Page]]

Latest revision as of 17:09, 23 June 2008