TestPlan.pm

- NAME
- EXTENDS
- DESCRIPTION
- METHODS
- SEE ALSO
- AUTHOR

# NAME

Bugzilla::Testopia::Webservice::TestPlan

# EXTENDS

Bugzilla::Webservice

# DESCRIPTION

Provides methods for automated scripts to manipulate Testopia TestPlans

# METHODS

`add_tag($plan_ids, $tags)`

       Description: Add one or more tags to the selected test plans.

       Params:      $plan_ids - Integer/Array/String: An integer or alias representing the ID in the database,
                        an arry of plan_ids or aliases, or a string of comma separated plan_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.

`create($values)`

       Description: Creates a new Test Plan 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 plan to be created.
        +-------------------------+----------------+-----------+------------------------------------+
        | Field                   | Type           | Null      | Description                        |
        +-------------------------+----------------+-----------+------------------------------------+
        | product                 | Integer/String | Required  | ID or Name of product              |
        | name                    | String         | Required  |                                    |
        | type                    | Integer/String | Required  | ID or name of plan type            |
        | default_product_version | String         | Required  |                                    |
        | isactive                | Boolean        | Optional  | 0: Archived 1: Active (Default 1)  |
        +-------------------------+----------------+-----------+------------------------------------+

       Returns:     The newly created object hash.

`get($plan_id)`

       Description: Used to load an existing test plan from the database.

       Params:      $id - Integer/String: An integer representing the ID in the database
                          for this plan.

       Returns:     A blessed Bugzilla::Testopia::TestPlan object hash

`get_change_history($plan_id)`

       Description: Get the list of changes to the fields of this plan.

       Params:      $plan_id - Integer/String: An integer representing the ID in the database
                          or a string representing the unique alias for this plan.

       Returns:     Array: An array of hashes with changed fields and their details.

`get_tags($plan_id)`

       Description: Get the list of tags attached to this plan.

       Params:      $plan_id - Integer/String: An integer representing the ID in the database
                          or a string representing the unique alias for this plan.

       Returns:     Array: An array of tag object hashes.

`get_test_cases($plan_id)`

       Description: Get the list of cases that this plan is linked to.

       Params:      $plan_id - Integer/String: An integer representing the ID in the database
                          for this plan.

       Returns:     Array: An array of test case object hashes.

`get_test_runs($plan_id)`

       Description: Get the list of runs in this plan.

       Params:      $plan_id - Integer/String: An integer representing the ID in the database
                          for this plan.

       Returns:     Array: An array of test run object hashes.

`get_text($plan_id, $version)`

       Description: The associated large text fields: Action, Expected Results, Setup, Breakdown
                    for a given version.

       Params:      $plan_id - Integer/String: An integer representing the ID in the database
                          or a string representing the unique alias for this plan.

                    $version - Integer: (OPTIONAL) The version of the text you want returned.
                          Defaults to the latest.

       Returns:     Hash: Text fields and values.

`list($query)`

       Description: Performs a search and returns the resulting list of test plans.

       Params:      $query - Hash: keys must match valid search fields.

          +--------------------------------------------------------+
          |                 Plan Search Parameters                 |
          +--------------------------------------------------------+
          |        Key          |          Valid Values            |
          | author              | A bugzilla login (email address) |
          | author_type         | (select from email_variants)     |
          | plan_id             | comma separated integers         |
          | plan_text           | String                           |
          | plan_text_type      | (select from query_variants)     |
          | plan_type           | String: Product Name             |
          | product             | String: Product Name             |
          | product_id          | Integer                          |
          | tags                | String                           |
          | tags_type           | (select from tag_variants)       |
          | type_id             | Integer                          |
          | version             | String: Product version          |
          +--------------------------------------------------------+

          +--------------------------------------------------------+
          |                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 0: first 25    |
          +--------------------------------------------------------+

          +----------------------------------------------------+
          |                 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 plans are retuned in a list of hashes.

`lookup_type_id_by_name`

       Params:      $name - String: the status name.

       Returns:     Integer: ID of the plan type.

`lookup_type_name_by_id`

       Params:      $id - Integer: ID of the plan stype to return

       Returns:     String: the type name.

`remove_tag($plan_id, $tag)`

       Description: Remove a tag from a plan.

       Params:      $plan_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.

`store_text($plan_id, $text, [$author_id])`

       Description: Update the document field of a plan.

       Params:      $plan_id - Integer: An integer representing the ID in the database.
                    $text - String: Text for the document. Can contain HTML.
                    [$author_id] = Integer/String: (OPTIONAL) The numeric ID or the login of the author.
                        Defaults to logged in user.

       Returns:     Array: Empty on success.

`update($ids, $values)`

       Description: Updates the fields of the selected test plan.

       Params:      $ids - Integer: A single TestPlan ID.

                    $values - Hash of keys matching TestPlan fields and the new values
                    to set each field to.
                            +-------------------------+----------------+
                            | Field                   | Type           |
                            +-------------------------+----------------+
                            | name                    | String         |
                            | type                    | Integer/String |
                            | default_product_version | String         |
                            | isactive                | Boolean        |
                            +-------------------------+----------------+

       Returns:     Hash: The updated test plan object.

# SEE ALSO

the Bugzilla::Testopia::TestPlan manpage the Bugzilla::Webservice manpage

# AUTHOR

Greg Hendricks <ghendricks@novell.com>