Nitrate XML-RPC Service API

前端之家收集整理的这篇文章主要介绍了Nitrate XML-RPC Service API前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Nitrate XML-RPC Service(Beta)

You need to invoke it using an XML-RPC Client!

python-nitrate is a Python interface to the Nitrate test case management system.

Changes from testopia

  • [Model].filter- The 'filter' method is the replacement of list method in testopia.
    It's a full featured wrapper of the 'filter' method of Django QuerySet.

    It have following star features:
    • Relationship- For example to get all of test cases belong to 'RHEL 5'
      We use the category path for recommend:
      1. >>> TestCase.filter({'category__product__name': 'Red Hat Enterprise Linux 5'})
    • Field lookups- For example to get all test cases with summary starts with 'test':
      1. >>> TestCase.filter({'summary__startswith': 'test'})
      Access this URL for more information.

  • [Model].filter_count - See [Model].filter.
  • Multiple operations- In Nitrate,most of functions are change to support multiple operations,
    including add_bug,remove_bug,add_tag,remove_tag
  • Argument and response changes- Most of the function argument are compatible with testopia,
    exclude some special function that not supported or deprecated.
    And the response changes to hash not a array of hash,not just a array only.

How to handle ForeignKey arguments

In addition to the basic types such as Integers,Strings,Boolean,there is a relationship type called ForeignKey.

The Syntax of using ForeignKey in our XMLRPC API is quite simple:

  1. foreignkey + '__' + fieldname + '__' + query_Syntax.

Taking TestCase.filter() for example,if the query is based on a default_tester's username starts with 'John',the Syntax will look like this:

  1. TestCase.filter({'user__username__startswith': 'John'})

In which case,the foreignkey is 'user',fieldname is 'username',and query_Syntax is 'startswith',they are joined together using double underscores '__'.

For all the XMLRPC API,we have listed the available ForeignKey,however,for the available foreignkey field names that can be used in a query,please check out Nitrate source code on fedora. The definitions are located in files named 'models.py'; for a detailed query Syntax documentation,please check out the Django documentation:

https://docs.djangoproject.com/en/1.2/topics/db/queries/#field-lookups

Available methods

Descriptions

Auth.login

  1. Description: Login into Nitrate
  2. Params: $parameters - Hash: keys must match valid search fields.
  3. +-------------------------------------------------------------------+
  4. | Login Parameters |
  5. +-------------------------------------------------------------------+
  6. | Key | Valid Values |
  7. | username | A nitrate login (email address) |
  8. | password | String |
  9. +-------------------------------------------------------------------+
  10.  
  11. Returns: String: Session ID.
  12.  
  13. Example:
  14. >>> Auth.login({'username': 'foo','password': 'bar'})

Auth.login_krbv

  1. Description: Login into the Nitrate deployed with mod_auth_kerb
  2.  
  3. Returns: String: Session ID.
  4.  
  5. Example:
  6. $ kinit
  7. Password for username@example.com:
  8.  
  9. $ python
  10. >>> Auth.login_krbv()

Auth.logout

  1. Description: Delete session information.

Build.check_build

  1. Description: Looks up and returns a build by name.
  2.  
  3. Params: $name - String: name of the build.
  4. $product - product_id of the product in the Database
  5.  
  6. Returns: Hash: Matching Build object hash or error if not found.
  7.  
  8. Example:
  9. # Get with product ID
  10. >>> Build.check_build('2008-02-25',61)
  11. # Get with product name
  12. >>> Build.check_build('2008-02-25','Red Hat Enterprise Linux 5')

Build.create

  1. Description: Creates a new build object and stores it in the database
  2.  
  3. Params: $values - Hash: A reference to a hash with keys and values
  4. matching the fields of the build to be created.
  5.  
  6. +-------------+----------------+-----------+---------------------------+
  7. | Field | Type | Null | Description |
  8. +-------------+----------------+-----------+---------------------------+
  9. | product | Integer/String | required | ID or Name of product |
  10. | name | String | required | |
  11. | description | String | Optional | |
  12. | is_active | Boolean | Optional | Defaults to True (1) |
  13. +-------------+----------------+-----------+---------------------------+
  14.  
  15. Returns: The newly created object hash.
  16.  
  17. Example:
  18. # Create build by product ID and set the build active.
  19. >>> Build.create({'product': 234,'name': 'tcms_testing','description': 'None','is_active': 1})
  20. # Create build by product name and set the build to inactive.
  21. >>> Build.create({'product': 'TCMS','name': 'tcms_testing 2','is_active': 0})

Build.get

  1. Description: Used to load an existing build from the database.
  2.  
  3. Params: $id - An integer representing the ID in the database
  4.  
  5. Returns: A blessed Build object hash
  6.  
  7. Example:
  8. >>> Build.get(1234)

Build.get_caseruns

  1. Description: Returns the list of case-runs that this Build is used in.
  2.  
  3. Params: $id - Integer: Build ID.
  4.  
  5. Returns: Array: List of case-run object hashes.
  6.  
  7. Example:
  8. >>> Build.get_caseruns(1234)

Build.get_runs

  1. Description: Returns the list of runs that this Build is used in.
  2.  
  3. Params: $id - Integer: Build ID.
  4.  
  5. Returns: Array: List of run object hashes.
  6.  
  7. Example:
  8. >>> Build.get_runs(1234)

Build.lookup_id_by_name

  1. DEPRECATED - CONSIDERED HARMFUL Use Build.check_build instead

Build.lookup_name_by_id

  1. DEPRECATED Use Build.get instead

Build.update

  1. Description: Updates the fields of the selected build or builds.
  2.  
  3. Params: $id - Integer: A single build ID.
  4.  
  5. $values - Hash of keys matching Build fields and the new values
  6. to set each field to.
  7.  
  8. +-------------+----------------+-----------+---------------------------+
  9. | Field | Type | Null | Description |
  10. +-------------+----------------+-----------+---------------------------+
  11. | product | Integer/String | Optional | ID or Name of product |
  12. | name | String | Optional | |
  13. | description | String | Optional | |
  14. | is_active | Boolean | Optional | True/False |
  15. +-------------+----------------+-----------+---------------------------+
  16.  
  17. Returns: Hash: The updated Build object hash.
  18.  
  19. Example:
  20. # Update name to 'foo' for build id 702
  21. >>> Build.update(702,{'name': 'foo'})
  22. # Update status to inactive for build id 702
  23. >>> Build.update(702,{'is_active': 0})

Env.filter_groups

  1. Description: Performs a search and returns the resulting list of env groups.
  2.  
  3. Params: $query - Hash: keys must match valid search fields.
  4.  
  5. +------------------------------------------------------------------+
  6. | Product Search Parameters |
  7. +------------------------------------------------------------------+
  8. | Key | Valid Values |
  9. | id | Integer: ID of env group |
  10. | name | String |
  11. | manager | ForeignKey: Auth.user |
  12. | modified_by | ForeignKey: Auth.user |
  13. | is_active | Boolean |
  14. | property | ForeignKey: TCMSEnvProperty |
  15. +------------------------------------------------------------------+
  16.  
  17. Returns: Array: Matching env groups are retuned in a list of hashes.
  18.  
  19. Example:
  20. # Get all of env group name contains 'Desktop'
  21. >>> Env.filter_groups({'name__icontains': 'Desktop'})

Env.filter_properties

  1. Description: Performs a search and returns the resulting list of env properties.
  2.  
  3. Params: $query - Hash: keys must match valid search fields.
  4.  
  5. +------------------------------------------------------------------+
  6. | Product Search Parameters |
  7. +------------------------------------------------------------------+
  8. | Key | Valid Values |
  9. | id | Integer: ID of env properties |
  10. | name | String |
  11. | is_active | Boolean |
  12. | group | ForeignKey: TCMSEnvGroup |
  13. | value | ForeignKey: TCMSEnvValues |
  14. +------------------------------------------------------------------+
  15.  
  16. Returns: Array: Matching env properties are retuned in a list of hashes.
  17.  
  18. Example:
  19. # Get all of env properties name contains 'Desktop'
  20. >>> Env.filter_properties({'name__icontains': 'Desktop'})

Env.filter_values

  1. Description: Performs a search and returns the resulting list of env properties.
  2.  
  3. Params: $query - Hash: keys must match valid search fields.
  4.  
  5. +------------------------------------------------------------------+
  6. | Product Search Parameters |
  7. +------------------------------------------------------------------+
  8. | Key | Valid Values |
  9. | id | Integer: ID of env value |
  10. | value | String |
  11. | is_active | Boolean |
  12. | property | ForeignKey: TCMSEnvProperty |
  13. +------------------------------------------------------------------+
  14.  
  15. Returns: Array: Matching env values are retuned in a list of hashes.
  16.  
  17. Example:
  18. # Get all of env values name contains 'Desktop'
  19. >>> Env.filter_values({'name__icontains': 'Desktop'})

Env.get_properties

  1. Description: Get the list of properties associated with this env group.
  2.  
  3. Params: $env_group_id - Integer: env_group_id of the env group in the Database
  4. Return all of properties when the argument is not specific.
  5. $is_active - Boolean: True to only include builds where is_active is true.
  6. Default: True
  7. Returns: Array: Returns an array of env properties objects.
  8.  
  9. Example:
  10. # Get all of properties
  11. >>> Env.get_properties()
  12. # Get the properties in group 10
  13. >>> Env.get_properties(10)

Env.get_values

  1. Description: Get the list of values associated with this env property.
  2.  
  3. Params: $env_property_id - Integer: env_property_id of the env property in the Database
  4. Return all of values when the argument is not specific.
  5. $is_active - Boolean: True to only include builds where is_active is true.
  6. Default: True
  7. Returns: Array: Returns an array of env values objects.
  8.  
  9. Example:
  10. # Get all of properties
  11. >>> Env.get_properties()
  12. # Get the properties in group 10
  13. >>> Env.get_properties(10)

Product.add_component

  1. Description: Add component to selected product.
  2.  
  3.  
  4. Params: $product - Integer/String
  5. Integer: product_id of the product in the Database
  6. String: Product name
  7. $name - String: Component name
  8. [$initial_owner_id] - Integer: (OPTIONAL) The numeric ID or the login of the author.
  9. Defaults to logged in user.
  10. [$initial_qa_contact_id] - Integer: (OPTIONAL) The numeric ID or the login of the author.
  11. Defaults to logged in user.
  12.  
  13.  
  14. Returns: Hash: Component object hash.
  15.  
  16. Example:
  17. >>> Product.add_component(71,'JPBMM')

Product.add_version

  1. Description: Add version to specified product.
  2.  
  3. Params: $product - Integer/String
  4. Integer: product_id of the product in the Database
  5. String: Product name
  6. $value - String
  7. The name of the version string.
  8.  
  9. Returns: Array: Returns the newly added version object,error info if Failed.
  10.  
  11. Example:
  12. # Add version for specified product:
  13. >>> Product.add_version({'value': 'devel','product': 272})
  14. {'product': 'QE Test Product','id': '1106','value': 'devel','product_id': 272}
  15. # Run it again:
  16. >>> Product.add_version({'value': 'devel','product': 272})
  17. [['__all__','Version with this Product and Value already exists.']]

Product.check_category

  1. Description: Looks up and returns a category by name.
  2.  
  3. Params: $name - String: name of the category.
  4. $product - Integer/String
  5. Integer: product_id of the product in the Database
  6. String: Product name
  7.  
  8. Returns: Hash: Matching Category object hash or error if not found.
  9.  
  10. Example:
  11. # Get with product ID
  12. >>> Product.check_category('Feature',61)
  13. # Get with product name
  14. >>> Product.check_category('Feature','Red Hat Enterprise Linux 5')

Product.check_component

  1. Description: Looks up and returns a component by name.
  2.  
  3. Params: $name - String: name of the category.
  4. $product - Integer/String
  5. Integer: product_id of the product in the Database
  6. String: Product name
  7.  
  8. Returns: Hash: Matching component object hash or error if not found.
  9.  
  10. Example:
  11. # Get with product ID
  12. >>> Product.check_component('acpi',61)
  13. # Get with product name
  14. >>> Product.check_component('acpi','Red Hat Enterprise Linux 5')

Product.check_product

  1. Description: Looks up and returns a validated product.
  2.  
  3. Params: $name - Integer/String
  4. Integer: product_id of the product in the Database
  5. String: Product name
  6.  
  7. Returns: Hash: Matching Product object hash or error if not found.
  8.  
  9. Example:
  10. # Get with product ID
  11. >>> Product.check_product(61)
  12. # Get with product name
  13. >>> Product.check_product('Red Hat Enterprise Linux 5')

Product.filter

  1. Description: Performs a search and returns the resulting list of products.
  2.  
  3. Params: $query - Hash: keys must match valid search fields.
  4.  
  5. +------------------------------------------------------------------+
  6. | Product Search Parameters |
  7. +------------------------------------------------------------------+
  8. | Key | Valid Values |
  9. | id | Integer: ID of product |
  10. | name | String |
  11. | classification | ForeignKey: Classfication |
  12. | description | String |
  13. +------------------------------------------------------------------+
  14.  
  15. Returns: Array: Matching products are retuned in a list of hashes.
  16.  
  17. Example:
  18. # Get all of product named 'Red Hat Enterprise Linux 5'
  19. >>> Product.filter({'name': 'Red Hat Enterprise Linux 5'})

Product.filter_categories

  1. Description: Performs a search and returns the resulting list of categories.
  2.  
  3. Params: $query - Hash: keys must match valid search fields.
  4.  
  5. +------------------------------------------------------------------+
  6. | Component Search Parameters |
  7. +------------------------------------------------------------------+
  8. | Key | Valid Values |
  9. | id | Integer: ID of product |
  10. | name | String |
  11. | product | ForeignKey: Product |
  12. | description | String |
  13. +------------------------------------------------------------------+
  14.  
  15. Returns: Array: Matching categories are retuned in a list of hashes.
  16.  
  17. Example:
  18. # Get all of categories named like 'libvirt'
  19. >>> Product.filter_categories({'name__icontains': 'regression'})
  20. # Get all of categories named in product 'Red Hat Enterprise Linux 5'
  21. >>> Product.filter_categories({'product__name': 'Red Hat Enterprise Linux 5'})

Product.filter_components

  1. Description: Performs a search and returns the resulting list of components.
  2.  
  3. Params: $query - Hash: keys must match valid search fields.
  4.  
  5. +------------------------------------------------------------------+
  6. | Component Search Parameters |
  7. +------------------------------------------------------------------+
  8. | Key | Valid Values |
  9. | id | Integer: ID of product |
  10. | name | String |
  11. | product | ForeignKey: Product |
  12. | initial_owner | ForeignKey: Auth.User |
  13. | initial_qa_contact | ForeignKey: Auth.User |
  14. | description | String |
  15. +------------------------------------------------------------------+
  16.  
  17. Returns: Array: Matching components are retuned in a list of hashes.
  18.  
  19. Example:
  20. # Get all of components named like 'libvirt'
  21. >>> Product.filter_components({'name__icontains': 'libvirt'})
  22. # Get all of components named in product 'Red Hat Enterprise Linux 5'
  23. >>> Product.filter_components({'product__name': 'Red Hat Enterprise Linux 5'})

Product.filter_versions

  1. Description: Performs a search and returns the resulting list of versions.
  2.  
  3. Params: $query - Hash: keys must match valid search fields.
  4.  
  5. +------------------------------------------------------------------+
  6. | Component Search Parameters |
  7. +------------------------------------------------------------------+
  8. | Key | Valid Values |
  9. | id | Integer: ID of product |
  10. | value | String |
  11. | product | ForeignKey: Product |
  12. +------------------------------------------------------------------+
  13.  
  14. Returns: Array: Matching versions are retuned in a list of hashes.
  15.  
  16. Example:
  17. # Get all of versions named like '2.4.0-SNAPSHOT'
  18. >>> Product.filter_versions({'value__icontains': '2.4.0-SNAPSHOT'})
  19. # Get all of filter_versions named in product 'Red Hat Enterprise Linux 5'
  20. >>> Product.filter_versions({'product__name': 'Red Hat Enterprise Linux 5'})

Product.get

  1. Description: Used to load an existing product from the database.
  2.  
  3. Params: $id - An integer representing the ID in the database
  4.  
  5. Returns: A blessed TCMS Product object hash
  6.  
  7. Example:
  8. >>> Product.get(61)

Product.get_builds

  1. Description: Get the list of builds associated with this product.
  2.  
  3. Params: $product - Integer/String
  4. Integer: product_id of the product in the Database
  5. String: Product name
  6. $is_active - Boolean: True to only include builds where is_active is true.
  7. Default: True
  8. Returns: Array: Returns an array of Build objects.
  9.  
  10. Example:
  11. # Get with product id including all builds
  12. >>> Product.get_builds(61)
  13. # Get with product name excluding all inactive builds
  14. >>> Product.get_builds('Red Hat Enterprise Linux 5',0)

Product.get_cases

  1. Description: Get the list of cases associated with this product.
  2.  
  3. Params: $product - Integer/String
  4. Integer: product_id of the product in the Database
  5. String: Product name
  6.  
  7. Returns: Array: Returns an array of TestCase objects.
  8.  
  9. Example:
  10. # Get with product id
  11. >>> Product.get_cases(61)
  12. # Get with product name
  13. >>> Product.get_cases('Red Hat Enterprise Linux 5')

Product.get_categories

  1. Description: Get the list of categories associated with this product.
  2.  
  3. Params: $product - Integer/String
  4. Integer: product_id of the product in the Database
  5. String: Product name
  6.  
  7. Returns: Array: Returns an array of Case Category objects.
  8.  
  9. Example:
  10. # Get with product id
  11. >>> Product.get_categories(61)
  12. # Get with product name
  13. >>> Product.get_categories('Red Hat Enterprise Linux 5')

Product.get_category

  1. Description: Get the category matching the given id.
  2.  
  3. Params: $id - Integer: ID of the category in the database.
  4.  
  5. Returns: Hash: Category object hash.
  6.  
  7. Example:
  8. >>> Product.get_category(11)

Product.get_component

  1. Description: Get the component matching the given id.
  2.  
  3. Params: $id - Integer: ID of the component in the database.
  4.  
  5. Returns: Hash: Component object hash.
  6.  
  7. Example:
  8. >>> Product.get_component(11)

Product.get_components

  1. Description: Get the list of components associated with this product.
  2.  
  3. Params: $product - Integer/String
  4. Integer: product_id of the product in the Database
  5. String: Product name
  6.  
  7. Returns: Array: Returns an array of Component objects.
  8.  
  9. Example:
  10. # Get with product id
  11. >>> Product.get_components(61)
  12. # Get with product name
  13. >>> Product.get_components('Red Hat Enterprise Linux 5')

Product.get_environments

  1. FIXME: NOT IMPLEMENTED

Product.get_milestones

  1. FIXME: NOT IMPLEMENTED

Product.get_plans

  1. Description: Get the list of plans associated with this product.
  2.  
  3. Params: $product - Integer/String
  4. Integer: product_id of the product in the Database
  5. String: Product name
  6.  
  7. Returns: Array: Returns an array of Test Plan objects.
  8.  
  9. Example:
  10. # Get with product id
  11. >>> Product.get_plans(61)
  12. # Get with product name
  13. >>> Product.get_plans('Red Hat Enterprise Linux 5')

Product.get_runs

  1. Description: Get the list of runs associated with this product.
  2.  
  3. Params: $product - Integer/String
  4. Integer: product_id of the product in the Database
  5. String: Product name
  6.  
  7. Returns: Array: Returns an array of Test Run objects.
  8.  
  9. Example:
  10. # Get with product id
  11. >>> Product.get_runs(61)
  12. # Get with product name
  13. >>> Product.get_runs('Red Hat Enterprise Linux 5')

Product.get_tag

  1. Description: Get the list of tags.
  2.  
  3. Params: $id - Integer: ID of the tag in the database.
  4.  
  5. Returns: Array: Returns an array of Tags objects.
  6.  
  7. Example:
  8. >>> Product.get_tag(10)

Product.get_versions

  1. Description: Get the list of versions associated with this product.
  2.  
  3. Params: $product - Integer/String
  4. Integer: product_id of the product in the Database
  5. String: Product name
  6.  
  7. Returns: Array: Returns an array of Version objects.
  8.  
  9. Example:
  10. # Get with product id
  11. >>> Product.get_runs(61)
  12. # Get with product name
  13. >>> Product.get_runs('Red Hat Enterprise Linux 5')

Product.lookup_id_by_name

  1. DEPRECATED - CONSIDERED HARMFUL Use Product.check_product instead

Product.lookup_name_by_id

  1. DEPRECATED Use Product.get instead

Product.update_component

  1. Description: Update component to selected product.
  2.  
  3. Params: $component_id - Integer: ID of the component in the database.
  4.  
  5. $values - Hash of keys matching TestCase fields and the new values
  6. to set each field to.
  7.  
  8. +-----------------------+----------------+-----------------------------------------+
  9. | Field | Type | Null |
  10. +-----------------------+----------------+-----------------------------------------+
  11. | name | String | Optional |
  12. | initial_owner_id | Integer | Optional(int - user_id) |
  13. | initial_qa_contact_id | Integer | Optional(int - user_id) |
  14. +-----------------------+----------------+-----------------------------------------+
  15.  
  16. Returns: Hash: Component object hash.
  17.  
  18. Example:
  19. >>> Product.update_component(71,{'name': 'NewName'})

Tag.get_tags

  1. Description: Get the list of tags.
  2.  
  3. Params: $values - Hash: keys must match valid search fields.
  4. +------------------------------------------------------------+
  5. | tag Search Parameters |
  6. +------------------------------------------------------------+
  7. | Key | Valid Values |
  8. | ids | List of Integer |
  9. | names | List of String |
  10. +------------------------------------------------------------+
  11.  
  12. Returns: Array: An array of tag object hashes.
  13.  
  14. Example:
  15.  
  16. >>> values= {'ids': [121,123]}
  17. >>> Tag.get_tags(values)

TestCase.add_comment

  1. Description: Adds comments to selected test cases.
  2.  
  3. Params: $case_ids - Integer/Array/String: An integer representing the ID in the database,an array of case_ids,or a string of comma separated case_ids.
  4.  
  5. $comment - String - The comment
  6.  
  7. Returns: Array: empty on success or an array of hashes with failure
  8. codes if a failure occured.
  9.  
  10. Example:
  11. # Add comment 'foobar' to case 1234
  12. >>> TestCase.add_comment(1234,'foobar')
  13. # Add 'foobar' to cases list [56789,12345]
  14. >>> TestCase.add_comment([56789,12345],'foobar')
  15. # Add 'foobar' to cases list '56789,12345' with String
  16. >>> TestCase.add_comment('56789,12345','foobar')

TestCase.add_component

  1. Description: Adds one or more components to the selected test cases.
  2.  
  3. Params: $case_ids - Integer/Array/String: An integer representing the ID in the database,or a string of comma separated case_ids.
  4.  
  5. $component_ids - Integer/Array/String - The component ID,an array of Component IDs
  6. or a comma separated list of component IDs
  7.  
  8. Returns: Array: empty on success or an array of hashes with failure
  9. codes if a failure occured.
  10.  
  11. Example:
  12. # Add component id 54321 to case 1234
  13. >>> TestCase.add_component(1234,54321)
  14. # Add component ids list [1234,5678] to cases list [56789,12345]
  15. >>> TestCase.add_component([56789,[1234,5678])
  16. # Add component ids list '1234,5678' to cases list '56789,12345' with String
  17. >>> TestCase.add_component('56789,'1234,5678')

TestCase.add_tag

  1. Description: Add one or more tags to the selected test cases.
  2.  
  3. Params: $case_ids - Integer/Array/String: An integer representing the ID in the database,or a string of comma separated case_ids.
  4.  
  5. $tags - String/Array - A single tag,an array of tags,or a comma separated list of tags.
  6.  
  7. Returns: Array: empty on success or an array of hashes with failure
  8. codes if a failure occured.
  9.  
  10. Example:
  11. # Add tag 'foobar' to case 1234
  12. >>> TestCase.add_tag(1234,'foobar')
  13. # Add tag list ['foo','bar'] to cases list [12345,67890]
  14. >>> TestCase.add_tag([12345,67890],['foo','bar'])
  15. # Add tag list ['foo',67890] with String
  16. >>> TestCase.add_tag('12345,67890','foo,bar')

TestCase.add_to_run

  1. Description: Add one or more cases to the selected test runs.
  2.  
  3. Params: $case_ids - Integer/Array/String: An integer representing the ID in the database,or a string of comma separated case_ids.
  4.  
  5. $run_ids - Integer/Array/String: An integer representing the ID in the database
  6. an array of IDs,or a comma separated list of IDs.
  7.  
  8. Returns: Array: empty on success or an array of hashes with failure
  9. codes if a failure occured.
  10.  
  11. Example:
  12. # Add case 1234 to run id 54321
  13. >>> TestCase.add_to_run(1234,54321)
  14. # Add case ids list [56789,12345] to run list [1234,5678]
  15. >>> TestCase.add_to_run([56789,5678])
  16. # Add case ids list 56789 and 12345 to run list 1234 and 5678 with String
  17. >>> TestCase.add_to_run('56789,5678')

TestCase.attach_bug

  1. Description: Add one or more bugs to the selected test cases.
  2.  
  3. Params: $values - Array/Hash: A reference to a hash or array of hashes with keys and values
  4. matching the fields of the test case bug to be created.
  5.  
  6. +-------------------+----------------+-----------+-------------------------------+
  7. | Field | Type | Null | Description |
  8. +-------------------+----------------+-----------+-------------------------------+
  9. | case_id | Integer | required | ID of Case |
  10. | bug_id | Integer | required | ID of Bug |
  11. | bug_system_id | Integer | required | 1: BZ(Default),2: JIRA |
  12. | summary | String | Optional | Bug summary |
  13. | description | String | Optional | Bug description |
  14. +-------------------+----------------+-----------+-------------------------------+
  15.  
  16. Returns: Array: empty on success or an array of hashes with failure
  17. codes if a failure occured.
  18.  
  19. Example:
  20. >>> TestCase.attach_bug({
  21. 'case_id': 12345,'bug_id': 67890,'bug_system_id': 1,'summary': 'Testing TCMS','description': 'Just foo and bar',})

TestCase.calculate_average_estimated_time

  1. Description: Returns an average estimated time for cases.
  2.  
  3. Params: $case_ids - Integer/String: An integer representing the ID in the database.
  4.  
  5. Returns: String: Time in "HH:MM:SS" format.
  6.  
  7. Example:
  8. >>> TestCase.calculate_average_time([609,610,611])

TestCase.calculate_total_estimated_time

  1. Description: Returns an total estimated time for cases.
  2.  
  3. Params: $case_ids - Integer/String: An integer representing the ID in the database.
  4.  
  5. Returns: String: Time in "HH:MM:SS" format.
  6.  
  7. Example:
  8. >>> TestCase.calculate_total_time([609,611])

TestCase.check_case_status

  1. Description: Looks up and returns a case status by name.
  2.  
  3. Params: $name - String: name of the case status.
  4.  
  5. Returns: Hash: Matching case status object hash or error if not found.
  6.  
  7. Example:
  8. >>> TestCase.check_case_status('proposed')

TestCase.check_priority

  1. Description: Looks up and returns a priority by name.
  2.  
  3. Params: $value - String: name of the priority.
  4.  
  5. Returns: Hash: Matching priority object hash or error if not found.
  6.  
  7. Example:
  8. >>> TestCase.check_priority('p1')

TestCase.create

  1. Description: Creates a new Test Case object and stores it in the database.
  2.  
  3. Params: $values - Array/Hash: A reference to a hash or array of hashes with keys and values
  4. matching the fields of the test case to be created.
  5. +----------------------------+----------------+-----------+---------------------------------------+
  6. | Field | Type | Null | Description |
  7. +----------------------------+----------------+-----------+---------------------------------------+
  8. | product | Integer | required | ID of Product |
  9. | category | Integer | required | ID of Category |
  10. | priority | Integer | required | ID of Priority |
  11. | summary | String | required | |
  12. | case_status | Integer | Optional | ID of case status |
  13. | plan | Array/Str/Int | Optional | ID or List of plan_ids |
  14. | component | Integer/String | Optional | ID of Priority |
  15. | default_tester | String | Optional | Login of tester |
  16. | estimated_time | String | Optional | 2h30m30s(recommend) or HH:MM:SS Format|
  17. | is_automated | Integer | Optional | 0: Manual,1: Auto,2: Both |
  18. | is_automated_proposed | Boolean | Optional | Default 0 |
  19. | script | String | Optional | |
  20. | arguments | String | Optional | |
  21. | requirement | String | Optional | |
  22. | alias | String | Optional | Must be unique |
  23. | action | String | Optional | |
  24. | effect | String | Optional | Expected Result |
  25. | setup | String | Optional | |
  26. | breakdown | String | Optional | |
  27. | tag | Array/String | Optional | String Comma separated |
  28. | bug | Array/String | Optional | String Comma separated |
  29. | extra_link | String | Optional | reference link |
  30. +----------------------------+----------------+-----------+---------------------------------------+
  31.  
  32. Returns: Array/Hash: The newly created object hash if a single case was created,or
  33. an array of objects if more than one was created. If any single case threw an
  34. error during creation,a hash with an ERROR key will be set in its place.
  35.  
  36. Example:
  37. # Minimal test case parameters
  38. >>> values = {
  39. 'category': 135,'product': 61,'summary': 'Testing XML-RPC','priority': 1,}
  40. >>> TestCase.create(values)

TestCase.detach_bug

  1. Description: Remove one or more bugs to the selected test cases.
  2.  
  3. Params: $case_ids - Integer/Array/String: An integer representing the ID in the database,or a string of comma separated case_ids
  4.  
  5. $bug_ids - Integer/Array/String: An integer representing the ID in the database,an array of bug_ids,or a string of comma separated primary key of bug_ids.
  6.  
  7. Returns: Array: empty on success or an array of hashes with failure
  8. codes if a failure occured.
  9.  
  10. Example:
  11. # Remove bug id 54321 from case 1234
  12. >>> TestCase.detach_bug(1234,54321)
  13. # Remove bug ids list [1234,5678] from cases list [56789,12345]
  14. >>> TestCase.detach_bug([56789,5678])
  15. # Remove bug ids list '1234,5678' from cases list '56789,12345' with String
  16. >>> TestCase.detach_bug('56789,5678')

TestCase.filter

  1. Description: Performs a search and returns the resulting list of test cases.
  2.  
  3. Params: $query - Hash: keys must match valid search fields.
  4.  
  5. +------------------------------------------------------------------+
  6. | Case Search Parameters |
  7. +------------------------------------------------------------------+
  8. | Key | Valid Values |
  9. | author | A bugzilla login (email address) |
  10. | attachment | ForeignKey: Attchment |
  11. | alias | String |
  12. | case_id | Integer |
  13. | case_status | ForeignKey: Case Stat |
  14. | category | ForeignKey: Category |
  15. | component | ForeignKey: Component |
  16. | default_tester | ForeignKey: Auth.User |
  17. | estimated_time | String: 2h30m30s(recommend) or HH:MM:SS |
  18. | plan | ForeignKey: Test Plan |
  19. | priority | ForeignKey: Priority |
  20. | category__product | ForeignKey: Product |
  21. | summary | String |
  22. | tags | ForeignKey: Tags |
  23. | create_date | Datetime |
  24. | is_automated | 1: Only show current 0: show not current |
  25. | script | Text |
  26. +------------------------------------------------------------------+
  27.  
  28. Returns: Array: Matching test cases are retuned in a list of hashes.
  29.  
  30. Example:
  31. # Get all of cases contain 'TCMS' in summary
  32. >>> TestCase.filter({'summary__icontain': 'TCMS'})
  33. # Get all of cases create by xkuang
  34. >>> TestCase.filter({'author__username': 'xkuang'})
  35. # Get all of cases the author name starts with x
  36. >>> TestCase.filter({'author__username__startswith': 'x'})
  37. # Get all of cases belong to the plan 137
  38. >>> TestCase.filter({'plan__plan_id': 137})
  39. # Get all of cases belong to the plan create by xkuang
  40. >>> TestCase.filter({'plan__author__username': 'xkuang'})
  41. # Get cases with ID 12345,23456,34567 - Here is only support array so far.
  42. >>> TestCase.filter({'case_id__in': [12345,34567]})

TestCase.filter_count

  1. Description: Performs a search and returns the resulting count of cases.
  2.  
  3. Params: $values - Hash: keys must match valid search fields (see filter).
  4.  
  5. Returns: Integer - total matching cases.
  6.  
  7. Example:
  8. # See TestCase.filter()

TestCase.get

  1. Description: Used to load an existing test case from the database.
  2.  
  3. Params: $id - Integer/String: An integer representing the ID in the database
  4.  
  5. Returns: A blessed TestCase object Hash
  6.  
  7. Example:
  8. >>> TestCase.get(1193)

TestCase.get_bug_systems

  1. Description: Used to load an existing test case bug system from the database.
  2.  
  3. Params: $id - Integer/String: An integer representing the ID in the database
  4.  
  5. Returns: Array: An array of bug object hashes.
  6.  
  7. Example:
  8. >>> TestCase.get_bug_systems(1)

TestCase.get_bugs

  1. Description: Get the list of bugs that are associated with this test case.
  2.  
  3. Params: $case_ids - Integer/String: An integer representing the ID in the database
  4.  
  5. Returns: Array: An array of bug object hashes.
  6.  
  7. Example:
  8. # Get bugs belong to ID 12345
  9. >>> TestCase.get_bugs(12345)
  10. # Get bug belong to case ids list [12456,23456]
  11. >>> TestCase.get_bugs([12456,23456])
  12. # Get bug belong to case ids list 12456 and 23456 with string
  13. >>> TestCase.get_bugs('12456,23456')

TestCase.get_case_run_history

  1. *** FIXME: NOT IMPLEMENTED - Case run history is different than before***
  2. Description: Get the list of case-runs for all runs this case appears in.
  3. To limit this list by build or other attribute,see TestCaseRun.filter.
  4.  
  5. Params: $case_id - Integer/String: An integer representing the ID in the database
  6.  
  7. Returns: Array: An array of case-run object hashes.
  8.  
  9. Example:
  10. >>> TestCase.get_case_run_history(12345)

TestCase.get_case_status

  1. Description: Get the case status matching the given id.
  2.  
  3. Params: $id - Integer: ID of the case status in the database.
  4.  
  5. Returns: Hash: case status object hash.
  6.  
  7. Example:
  8. # Get all of case status
  9. >>> TestCase.get_case_status()
  10. # Get case status by ID 1
  11. >>> TestCase.get_case_status(1)

TestCase.get_change_history

  1. *** FIXME: NOT IMPLEMENTED - Case history is different than before***
  2. Description: Get the list of changes to the fields of this case.
  3.  
  4. Params: $case_id - Integer/String: An integer representing the ID in the database
  5.  
  6. Returns: Array: An array of hashes with changed fields and their details.
  7.  
  8. Example:
  9. >>> TestCase.get_change_history(12345)

TestCase.get_components

  1. "
  2. Description: Get the list of components attached to this case.
  3.  
  4. Params: $case_id - Integer/String: An integer representing the ID in the database
  5.  
  6. Returns: Array: An array of component object hashes.
  7.  
  8. Example:
  9. >>> TestCase.get_components(12345)

TestCase.get_plans

  1. Description: Get the list of plans that this case is linked to.
  2.  
  3. Params: $case_id - Integer/String: An integer representing the ID in the database
  4.  
  5. Returns: Array: An array of test plan object hashes.
  6.  
  7. Example:
  8. >>> TestCase.get_plans(12345)

TestCase.get_priority

  1. Description: Get the priority matching the given id.
  2.  
  3. Params: $id - Integer: ID of the priority in the database.
  4.  
  5. Returns: Hash: Priority object hash.
  6.  
  7. Example:
  8. >>> TestCase.get_priority(1)

TestCase.get_tags

  1. Description: Get the list of tags attached to this case.
  2.  
  3. Params: $case_id - Integer/String: An integer representing the ID in the database
  4.  
  5. Returns: Array: An array of tag object hashes.
  6.  
  7. Example:
  8. >>> TestCase.get_tags(12345)

TestCase.get_text

  1. Description: The associated large text fields: Action,Expected Results,Setup,Breakdown
  2. for a given version.
  3.  
  4. Params: $case_id - Integer/String: An integer representing the ID in the database
  5.  
  6. $version - Integer: (OPTIONAL) The version of the text you want returned.
  7. Defaults to the latest.
  8.  
  9. Returns: Hash: case text object hash.
  10.  
  11. Example:
  12. # Get all latest case text
  13. >>> TestCase.get_text(12345)
  14. # Get all case text with version 4
  15. >>> TestCase.get_text(12345,4)

TestCase.link_plan

  1. "
  2. Description: Link test cases to the given plan.
  3.  
  4. Params: $case_ids - Integer/Array/String: An integer representing the ID in the database,or a string of comma separated case_ids.
  5.  
  6. $plan_ids - Integer/Array/String: An integer representing the ID in the database,an array of plan_ids,or a string of comma separated plan_ids.
  7.  
  8. Returns: Array: empty on success or an array of hashes with failure
  9. codes if a failure occurs
  10.  
  11. Example:
  12. # Add case 1234 to plan id 54321
  13. >>> TestCase.link_plan(1234,12345] to plan list [1234,5678]
  14. >>> TestCase.link_plan([56789,5678])
  15. # Add case ids list 56789 and 12345 to plan list 1234 and 5678 with String
  16. >>> TestCase.link_plan('56789,5678')

TestCase.lookup_category_id_by_name

  1. DEPRECATED - CONSIDERED HARMFUL Use Product.check_category instead

TestCase.lookup_category_name_by_id

  1. DEPRECATED - CONSIDERED HARMFUL Use Product.get_category instead

TestCase.lookup_priority_id_by_name

  1. DEPRECATED - CONSIDERED HARMFUL Use TestCase.check_priority instead

TestCase.lookup_priority_name_by_id

  1. DEPRECATED - CONSIDERED HARMFUL Use TestCase.get_priority instead

TestCase.lookup_status_id_by_name

  1. DEPRECATED - CONSIDERED HARMFUL Use TestCase.check_case_status instead

TestCase.lookup_status_name_by_id

  1. DEPRECATED - CONSIDERED HARMFUL Use TestCase.get_case_status instead

TestCase.notification_add_cc

  1. Description: Add email addresses to the notification CC list of specific TestCases
  2.  
  3. Params: $case_ids - Integer/Array: one or more TestCase IDs
  4.  
  5. $cc_list - Array: one or more Email addresses,which will be
  6. added to each TestCase indicated by the case_ids.
  7.  
  8. Returns: JSON. When succeed,status is 0,and message maybe empty or
  9. anything else that depends on the implementation. If something
  10. wrong,status will be 1 and message will be a short description
  11. to the error.

TestCase.notification_get_cc_list

  1. Description: Return whole CC list of each TestCase
  2.  
  3. Params: $case_ids - Integer/Array: one or more TestCase IDs
  4.  
  5. Returns: An dictionary object with case_id as key and a list of CC as the value
  6. Each case_id will be converted to a str object in the result.

TestCase.notification_remove_cc

  1. Description: Remove email addresses from the notification CC list of specific TestCases
  2.  
  3. Params: $case_ids - Integer/Array: one or more TestCase IDs
  4.  
  5. $cc_list - Array: contians the email addresses that will
  6. be removed from each TestCase indicated by case_ids.
  7.  
  8. Returns: JSON. When succeed,status will be 1 and message will be a short description
  9. to the error.

TestCase.remove_component

  1. Description: Removes selected component from the selected test case.
  2.  
  3. Params: $case_ids - Integer/Array/String: An integer representing the ID in the database,or a string of comma separated case_ids.
  4.  
  5. $component_ids - Integer: - The component ID to be removed.
  6.  
  7. Returns: Array: Empty on success.
  8.  
  9. Example:
  10. # Remove component id 54321 from case 1234
  11. >>> TestCase.remove_component(1234,54321)
  12. # Remove component ids list [1234,12345]
  13. >>> TestCase.remove_component([56789,5678])
  14. # Remove component ids list '1234,12345' with String
  15. >>> TestCase.remove_component('56789,5678')

TestCase.remove_tag

  1. Description: Remove a tag from a case.
  2.  
  3. Params: $case_ids - Integer/Array/String: An integer or alias representing the ID in the database,or a string of comma separated case_ids.
  4.  
  5. $tags - String/Array - A single or multiple tag to be removed.
  6.  
  7. Returns: Array: Empty on success.
  8.  
  9. Example:
  10. # Remove tag 'foo' from case 1234
  11. >>> TestCase.remove_tag(1234,'foo')
  12. # Remove tag 'foo' and bar from cases list [56789,12345]
  13. >>> TestCase.remove_tag([56789,'bar'])
  14. # Remove tag 'foo' and 'bar' from cases list '56789,12345' with String
  15. >>> TestCase.remove_tag('56789,bar')

TestCase.store_text

  1. Description: Update the large text fields of a case.
  2.  
  3. Params: $case_id - Integer: An integer or alias representing the ID in the database.
  4. $action,$effect,$setup,$breakdown - String: Text for these fields.
  5. [$author_id] = Integer/String: (OPTIONAL) The numeric ID or the login of the author.
  6. Defaults to logged in user
  7.  
  8. Returns: Hash: case text object hash.
  9.  
  10. Example:
  11. # Minimal
  12. >>> TestCase.store_text(12345,'Action')
  13. # Full arguments
  14. >>> TestCase.store_text(12345,'Action','Effect','Setup','Breakdown',2260)

TestCase.unlink_plan

  1. Description: Unlink a test case from the given plan. If only one plan is linked,this will delete
  2. the test case.
  3.  
  4. Params: $case_ids - Integer/String: An integer or alias representing the ID in the database.
  5. $plan_id - Integer: An integer representing the ID in the database.
  6.  
  7. Returns: Array: Array of plans hash still linked if any,empty if not.
  8.  
  9. Example:
  10. >>> TestCase.unlink_plan(12345,137)

TestCase.update

  1. Description: Updates the fields of the selected case or cases.
  2.  
  3. Params: $case_ids - Integer/String/Array
  4. Integer: A single TestCase ID.
  5. String: A comma separates string of TestCase IDs for batch
  6. processing.
  7. Array: An array of case IDs for batch mode processing
  8.  
  9. $values - Hash of keys matching TestCase fields and the new values
  10. to set each field to.
  11.  
  12. Returns: Array: an array of case hashes. If the update on any particular
  13. case Failed,the has will contain a ERROR key and the
  14. message as to why it Failed.
  15. +-----------------------+----------------+-----------------------------------------+
  16. | Field | Type | Null |
  17. +-----------------------+----------------+-----------------------------------------+
  18. | case_status | Integer | Optional |
  19. | product | Integer | Optional(required if changes category) |
  20. | category | Integer | Optional |
  21. | priority | Integer | Optional |
  22. | default_tester | String/Integer | Optional(str - user_name,int - user_id)|
  23. | estimated_time | String | Optional(2h30m30s(recommend) or HH:MM:SS|
  24. | is_automated | Integer | Optional(0 - Manual,1 - Auto,2 - Both)|
  25. | is_automated_proposed | Boolean | Optional |
  26. | script | String | Optional |
  27. | arguments | String | Optional |
  28. | summary | String | Optional |
  29. | requirement | String | Optional |
  30. | alias | String | Optional |
  31. | notes | String | Optional |
  32. | extra_link | String | Optional(reference link)
  33. +-----------------------+----------------+-----------------------------------------+
  34.  
  35. Example:
  36. # Update alias to 'tcms' for case 12345 and 23456
  37. >>> TestCase.update([12345,23456],{'alias': 'tcms'})

TestCasePlan.get

  1. Description: Used to load an existing test-case-plan from the database.
  2.  
  3. Params: $case_id - Integer: An integer representing the ID of the test case in the database.
  4. $plan_id - Integer: An integer representing the ID of the test plan in the database.
  5.  
  6. Returns: A blessed TestCasePlan object hash
  7.  
  8. Example:
  9. >>> TestCasePlan.get(81307,3551)

TestCasePlan.update

  1. Description: Updates the sortkey of the selected test-case-plan.
  2.  
  3. Params: $case_id - Integer: An integer representing the ID of the test case in the database.
  4. $plan_id - Integer: An integer representing the ID of the test plan in the database.
  5. $sortkey - Integer: An integer representing the ID of the sortkey in the database.
  6.  
  7. Returns: A blessed TestCasePlan object hash
  8.  
  9. Example:
  10. # Update sortkey of selected test-case-plan to 450
  11. >>> TestCasePlan.update(81307,3551,450)

TestCaseRun.add_comment

  1. Description: Adds comments to selected test case runs.
  2.  
  3. Params: $case_run_ids - Integer/Array/String: An integer representing the ID in the database,an array of case_run_ids,or a string of comma separated case_run_ids.
  4.  
  5. $comment - String - The comment
  6.  
  7. Returns: Array: empty on success or an array of hashes with failure
  8. codes if a failure occured.
  9.  
  10. Example:
  11. # Add comment 'foobar' to case run 1234
  12. >>> TestCaseRun.add_comment(1234,'foobar')
  13. # Add 'foobar' to case runs list [56789,12345]
  14. >>> TestCaseRun.add_comment([56789,'foobar')
  15. # Add 'foobar' to case runs list '56789,12345' with String
  16. >>> TestCaseRun.add_comment('56789,'foobar')

TestCaseRun.attach_bug

  1. Description: Add one or more bugs to the selected test cases.
  2.  
  3. Params: $values - Array/Hash: A reference to a hash or array of hashes with keys and values
  4. matching the fields of the test case bug to be created.
  5.  
  6. +-------------------+----------------+-----------+------------------------+
  7. | Field | Type | Null | Description |
  8. +-------------------+----------------+-----------+------------------------+
  9. | case_run_id | Integer | required | ID of Case |
  10. | bug_id | Integer | required | ID of Bug |
  11. | bug_system_id | Integer | required | 1: BZ(Default),2: JIRA|
  12. | summary | String | Optional | Bug summary |
  13. | description | String | Optional | Bug description |
  14. +-------------------+----------------+-----------+------------------------+
  15.  
  16. Returns: Array: empty on success or an array of hashes with failure
  17. codes if a failure occured.
  18.  
  19. Example:
  20. >>> TestCaseRun.attach_bug({
  21. 'case_run_id': 12345,})

TestCaseRun.attach_log

  1. Description: Add new log link to TestCaseRun
  2.  
  3. Params: $caserun_id - Integer
  4. $name - String: A short description to this new link,and accept 64 characters at most.
  5. $url - String: The actual URL.

TestCaseRun.check_case_run_status

  1. Params: $name - String: the status name.
  2.  
  3. Returns: Hash: Matching case run status object hash or error if not found.
  4.  
  5. Example:
  6. >>> TestCaseRun.check_case_run_status('idle')

TestCaseRun.create

  1. *** It always report - ValueError: invalid literal for int() with base 10: '' ***
  2.  
  3. Description: Creates a new Test Case Run object and stores it in the database.
  4.  
  5. Params: $values - Hash: A reference to a hash with keys and values
  6. matching the fields of the test case to be created.
  7. +--------------------+----------------+-----------+------------------------------------------------+
  8. | Field | Type | Null | Description |
  9. +--------------------+----------------+-----------+------------------------------------------------+
  10. | run | Integer | required | ID of Test Run |
  11. | case | Integer | required | ID of test case |
  12. | build | Integer | required | ID of a Build in plan's product |
  13. | assignee | Integer | Optional | ID of assignee |
  14. | case_run_status | Integer | Optional | Defaults to "IDLE" |
  15. | case_text_version | Integer | Optional | Default to latest case text version |
  16. | notes | String | Optional | |
  17. | sortkey | Integer | Optional | a.k.a. Index,Default to 0 |
  18. +--------------------+----------------+-----------+------------------------------------------------+
  19.  
  20. Returns: The newly created object hash.
  21.  
  22. Example:
  23. # Minimal test case parameters
  24. >>> values = {
  25. 'run': 1990,'case': 12345,'build': 123,}
  26. >>> TestCaseRun.create(values)

TestCaseRun.detach_bug

  1. Description: Remove one or more bugs to the selected test case-runs.
  2.  
  3. Params: $case_run_ids - Integer/Array/String: An integer or alias representing the ID in the database,or a string of comma separated case_run_ids.
  4.  
  5. $bug_ids - Integer/Array/String: An integer representing the ID in the database,or a string of comma separated primary key of bug_ids.
  6.  
  7. Returns: Array: empty on success or an array of hashes with failure
  8. codes if a failure occured.
  9.  
  10. Example:
  11. # Remove bug id 54321 from case 1234
  12. >>> TestCaseRun.detach_bug(1234,12345]
  13. >>> TestCaseRun.detach_bug([56789,12345' with String
  14. >>> TestCaseRun.detach_bug('56789,5678')

TestCaseRun.detach_log

  1. Description: Remove log link to TestCaseRun
  2.  
  3. Params: $case_run_id - Integer
  4. $link_id - Integer: Id of LinkReference instance

TestCaseRun.filter

  1. Description: Performs a search and returns the resulting list of test cases.
  2.  
  3. Params: $values - Hash: keys must match valid search fields.
  4.  
  5. +----------------------------------------------------------------+
  6. | Case-Run Search Parameters |
  7. +----------------------------------------------------------------+
  8. | Key | Valid Values |
  9. | case_run_id | Integer |
  10. | assignee | ForeignKey: Auth.User |
  11. | build | ForeignKey: Build |
  12. | case | ForeignKey: Test Case |
  13. | case_run_status | ForeignKey: Case Run Status |
  14. | notes | String |
  15. | run | ForeignKey: Test Run |
  16. | tested_by | ForeignKey: Auth.User |
  17. | running_date | Datetime |
  18. | close_date | Datetime |
  19. +----------------------------------------------------------------+
  20.  
  21. Returns: Object: Matching test cases are retuned in a list of hashes.
  22.  
  23. Example:
  24. # Get all case runs contain 'TCMS' in case summary
  25. >>> TestCaseRun.filter({'case__summary__icontain': 'TCMS'})

TestCaseRun.filter_count

  1. Description: Performs a search and returns the resulting count of cases.
  2.  
  3. Params: $query - Hash: keys must match valid search fields (see filter).
  4.  
  5. Returns: Integer - total matching cases.
  6.  
  7. Example:
  8. # See distinct_count()

TestCaseRun.get

  1. Description: Used to load an existing test case-run from the database.
  2.  
  3. Params: $case_run_id - Integer: An integer representing the ID in
  4. the database for this case-run.
  5.  
  6. Returns: A blessed TestCaseRun object hash
  7.  
  8. Example:
  9. >>> TestCaseRun.get(1193)

TestCaseRun.get_bugs

  1. Description: Get the list of bugs that are associated with this test case.
  2.  
  3. Params: $case_run_ids - Integer: An integer representing the ID in
  4. the database for this case-run.
  5.  
  6. Returns: Array: An array of bug object hashes.
  7.  
  8. Example:
  9. >>> TestCase.get_bugs(12345)

TestCaseRun.get_bugs_s

  1. Description: Get the list of bugs that are associated with this test case.
  2.  
  3. Params: $run_id - Integer: An integer representing the ID of the test run in the database.
  4. $case_id - Integer: An integer representing the ID of the test case in the database.
  5. $build_id - Integer: An integer representing the ID of the test build in the database.
  6. $environment_id - Optional Integer: An integer representing the ID of the environment in the database.
  7.  
  8. Returns: Array: An array of bug object hashes.
  9.  
  10. Example:
  11. >>> TestCaseRun.get_bugs_s(3113,565,72,90)

TestCaseRun.get_case_run_status

  1. Params: $case_run_status_id - Integer(Optional): ID of the status to return
  2.  
  3. Returns: Hash: Matching case run status object hash when your specific the case_run_status_id
  4. or return all of case run status.
  5. It will return error the case run status you specific id not found.
  6.  
  7. Example:
  8. # Get all of case run status
  9. >>> TestCaseRun.get_case_run_status()
  10. # Get case run status by ID 1
  11. >>> TestCaseRun.get_case_run_status(1)

TestCaseRun.get_completion_time

  1. Description: Returns the time in seconds that it took for this case to complete.
  2.  
  3. Params: $case_run_id - Integer: An integer representing the ID in
  4. the database for this case-run.
  5.  
  6. Returns: Integer: Seconds since run was started till this case was completed.
  7. Or empty hash for insufficent data.
  8.  
  9. Example:
  10. >>> TestCaseRun.get_completion_time(1193)

TestCaseRun.get_completion_time_s

  1. Description: Returns the time in seconds that it took for this case to complete.
  2.  
  3. Params: $case_id - Integer: An integer representing the ID of the test case in the database.
  4. $run_id - Integer: An integer representing the ID of the test run in the database.
  5. $build_id - Integer: An integer representing the ID of the test build in the database.
  6. $environment_id - Optional Integer: An integer representing the ID of the environment in the database.
  7.  
  8. Returns: Integer: Seconds since run was started till this case was completed.
  9. Or empty hash for insufficent data.
  10.  
  11. Example:
  12. >>> TestCaseRun.get_completion_time_s(3113,90)

TestCaseRun.get_history

  1. *** FIXME: NOT IMPLEMENTED - Case history is different than before ***
  2. Description: Get the list of case-runs for all runs this case appears in.
  3. To limit this list by build or other attribute,see TestCaseRun.query
  4.  
  5. Params: $caserun_id - Integer: An integer representing the ID in
  6. the database for this case-run.
  7.  
  8. Returns: Array: An array of case-run object hashes.

TestCaseRun.get_history_s

  1. *** FIXME: NOT IMPLEMENTED - Case history is different than before ***
  2. Description: Get the list of case-runs for all runs this case appears in.
  3. To limit this list by build or other attribute,see TestCaseRun.filter.
  4.  
  5. Params: $case_id - Integer: An integer representing the ID of the test case in the database.
  6. $run_id - Integer: An integer representing the ID of the test run in the database.
  7. $build_id - Integer: An integer representing the ID of the test build in the database.
  8. $environment_id - Integer: An integer representing the ID of the environment in the database.
  9.  
  10. Returns: Array: An array of case-run object hashes.

TestCaseRun.get_logs

  1. Description: Get log links to TestCaseRun
  2.  
  3. Params: $case_run_id - Integer:

TestCaseRun.get_s

  1. Description: Used to load an existing test case from the database.
  2.  
  3. Params: $case_id - Integer: An integer representing the ID of the test case in the database.
  4. $run_id - Integer: An integer representing the ID of the test run in the database.
  5. $build_id - Integer: An integer representing the ID of the test build in the database.
  6. $environment_id - Optional Integer: An integer representing the ID of the environment in the database.
  7.  
  8. Returns: A blessed TestCaseRun object hash
  9.  
  10. Example:
  11. >>> TestCaseRun.get_s(3113,90)

TestCaseRun.lookup_status_id_by_name

  1. DEPRECATED - CONSIDERED HARMFUL Use TestCaseRun.check_case_run_status instead

TestCaseRun.lookup_status_name_by_id

  1. DEPRECATED - CONSIDERED HARMFUL Use TestCaseRun.get_case_run_status instead

TestCaseRun.update

  1. Description: Updates the fields of the selected case-runs.
  2.  
  3. Params: $caserun_ids - Integer/String/Array
  4. Integer: A single TestCaseRun ID.
  5. String: A comma separates string of TestCaseRun IDs for batch
  6. processing.
  7. Array: An array of TestCaseRun IDs for batch mode processing
  8.  
  9. $values - Hash of keys matching TestCaseRun fields and the new values
  10. to set each field to.
  11. +--------------------+----------------+
  12. | Field | Type |
  13. +--------------------+----------------+
  14. | build | Integer |
  15. | assignee | Integer |
  16. | case_run_status | Integer |
  17. | notes | String |
  18. | sortkey | Integer |
  19. +--------------------+----------------+
  20.  
  21. Returns: Hash/Array: In the case of a single object,it is returned. If a
  22. list was passed,it returns an array of object hashes. If the
  23. update on any particular object Failed,the hash will contain a
  24. ERROR key and the message as to why it Failed.
  25.  
  26. Example:
  27. # Update alias to 'tcms' for case 12345 and 23456
  28. >>> TestCaseRun.update([12345,{'assignee': 2206})

TestPlan.add_component

  1. Description: Adds one or more components to the selected test plan.
  2.  
  3. Params: $plan_ids - Integer/Array/String: An integer representing the ID of the plan in the database.
  4. $component_ids - Integer/Array/String - The component ID,an array of Component IDs
  5. or a comma separated list of component IDs.
  6.  
  7. Returns: Array: empty on success or an array of hashes with failure
  8. codes if a failure occured.
  9.  
  10. Example:
  11. # Add component id 54321 to plan 1234
  12. >>> TestPlan.add_component(1234,5678] to plan list [56789,12345]
  13. >>> TestPlan.add_component([56789,5678' to plan list '56789,12345' with String
  14. >>> TestPlan.add_component('56789,5678')

TestPlan.add_tag

  1. Description: Add one or more tags to the selected test plans.
  2.  
  3. Params: $plan_ids - Integer/Array/String: An integer representing the ID of the plan in the database,an arry of plan_ids,or a string of comma separated plan_ids.
  4.  
  5. $tags - String/Array - A single tag,or a comma separated list of tags.
  6.  
  7. Returns: Array: empty on success or an array of hashes with failure
  8. codes if a failure occured.
  9.  
  10. Example:
  11. # Add tag 'foobar' to plan 1234
  12. >>> TestPlan.add_tag(1234,'bar'] to plan list [12345,67890]
  13. >>> TestPlan.add_tag([12345,67890] with String
  14. >>> TestPlan.add_tag('12345,bar')

TestPlan.check_plan_type

  1. Params: $name - String: the plan type.
  2.  
  3. Returns: Hash: Matching plan type object hash or error if not found.
  4.  
  5. Example:
  6. >>> TestPlan.check_plan_type('regression')

TestPlan.create

  1. Description: Creates a new Test Plan object and stores it in the database.
  2.  
  3. Params: $values - Hash: A reference to a hash with keys and values
  4. matching the fields of the test plan to be created.
  5. +-------------------------------------------+----------------+-----------+-------------------------------------------+
  6. | Field | Type | Null | Description |
  7. +-------------------------------------------+----------------+-----------+-------------------------------------------+
  8. | product | Integer | required | ID of product |
  9. | name | String | required | |
  10. | type | Integer | required | ID of plan type |
  11. | product_version(default_product_version) | Integer | required | ID of version,product_version(recommend),|
  12. | | | | default_product_version will be deprecated|
  13. | | | | in future release. |
  14. | text | String | required | Plan documents,HTML acceptable. |
  15. | parent | Integer | Optional | Parent plan ID |
  16. | is_active | Boolean | Optional | 0: Archived 1: Active (Default 0) |
  17. +-------------------------------------------+----------------+-----------+-------------------------------------------+
  18.  
  19. Returns: The newly created object hash.
  20.  
  21. Example:
  22. # Minimal test case parameters
  23. >>> values = {
  24. 'product': 61,'name': 'Testplan foobar','type': 1,'parent_id': 150,'default_product_version': 93,'text':'Testing TCMS',}
  25. >>> TestPlan.create(values)

TestPlan.filter

  1. Description: Performs a search and returns the resulting list of test plans.
  2.  
  3. Params: $values - Hash: keys must match valid search fields.
  4.  
  5. +------------------------------------------------------------+
  6. | Plan Search Parameters |
  7. +----------------------------------------------------------+
  8. | Key | Valid Values |
  9. | author | ForeignKey: Auth.User |
  10. | attachment | ForeignKey: Attachment |
  11. | case | ForeignKey: Test Case |
  12. | create_date | DateTime |
  13. | env_group | ForeignKey: Environment Group |
  14. | name | String |
  15. | plan_id | Integer |
  16. | product | ForeignKey: Product |
  17. | product_version | ForeignKey: Version |
  18. | tag | ForeignKey: Tag |
  19. | text | ForeignKey: Test Plan Text |
  20. | type | ForeignKey: Test Plan Type |
  21. +------------------------------------------------------------+
  22.  
  23. Returns: Array: Matching test plans are retuned in a list of plan object hashes.
  24.  
  25. Example:
  26. # Get all of plans contain 'TCMS' in name
  27. >>> TestPlan.filter({'name__icontain': 'TCMS'})
  28. # Get all of plans create by xkuang
  29. >>> TestPlan.filter({'author__username': 'xkuang'})
  30. # Get all of plans the author name starts with x
  31. >>> TestPlan.filter({'author__username__startswith': 'x'})
  32. # Get plans contain the case ID 12345,34567
  33. >>> TestPlan.filter({'case__case_id__in': [12345,34567]})

TestPlan.filter_count

  1. Description: Performs a search and returns the resulting count of plans.
  2.  
  3. Params: $values - Hash: keys must match valid search fields (see filter).
  4.  
  5. Returns: Integer - total matching plans.
  6.  
  7. Example:
  8. # See distinct_count()

TestPlan.get

  1. Description: Used to load an existing test plan from the database.
  2.  
  3. Params: $id - Integer/String: An integer representing the ID of this plan in the database
  4.  
  5. Returns: Hash: A blessed TestPlan object hash
  6.  
  7. Example:
  8. >>> TestPlan.get(137)

TestPlan.get_all_cases_tags

  1. Description: Get the list of tags attached to this plan's testcases.
  2.  
  3. Params: $plan_id - Integer An integer representing the ID of this plan in the database
  4.  
  5. Returns: Array: An array of tag object hashes.
  6.  
  7. Example:
  8. >>> TestPlan.get_all_cases_tags(137)

TestPlan.get_change_history

  1. *** FIXME: NOT IMPLEMENTED - History is different than before ***
  2. Description: Get the list of changes to the fields of this plan.
  3.  
  4. Params: $plan_id - Integer: An integer representing the ID of this plan in the database
  5.  
  6. Returns: Array: An array of hashes with changed fields and their details.

TestPlan.get_components

  1. Description: Get the list of components attached to this plan.
  2.  
  3. Params: $plan_id - Integer/String: An integer representing the ID in the database
  4.  
  5. Returns: Array: An array of component object hashes.
  6.  
  7. Example:
  8. >>> TestPlan.get_components(12345)

TestPlan.get_env_groups

  1. Description: Get the list of env groups to the fields of this plan.
  2.  
  3. Params: $plan_id - Integer: An integer representing the ID of this plan in the database
  4.  
  5. Returns: Array: An array of hashes with env groups.

TestPlan.get_plan_type

  1. Params: $id - Integer: ID of the plan type to return
  2.  
  3. Returns: Hash: Matching plan type object hash or error if not found.
  4.  
  5. Example:
  6. >>> TestPlan.get_plan_type(3)

TestPlan.get_product

  1. Description: Get the Product the plan is assiciated with.
  2.  
  3. Params: $plan_id - Integer: An integer representing the ID of the plan in the database.
  4.  
  5. Returns: Hash: A blessed Product hash.
  6.  
  7. Example:
  8. >>> TestPlan.get_product(137)

TestPlan.get_tags

  1. Description: Get the list of tags attached to this plan.
  2.  
  3. Params: $plan_id - Integer An integer representing the ID of this plan in the database
  4.  
  5. Returns: Array: An array of tag object hashes.
  6.  
  7. Example:
  8. >>> TestPlan.get_tags(137)

TestPlan.get_test_cases

  1. Description: Get the list of cases that this plan is linked to.
  2.  
  3. Params: $plan_id - Integer: An integer representing the ID of the plan in the database
  4.  
  5. Returns: Array: An array of test case object hashes.
  6.  
  7. Example:
  8. >>> TestPlan.get_test_cases(137)

TestPlan.get_test_runs

  1. Description: Get the list of runs in this plan.
  2.  
  3. Params: $plan_id - Integer: An integer representing the ID of this plan in the database
  4.  
  5. Returns: Array: An array of test run object hashes.
  6.  
  7. Example:
  8. >>> TestPlan.get_test_runs(plan_id)

TestPlan.get_text

  1. Description: The plan document for a given test plan.
  2.  
  3. Params: $plan_id - Integer: An integer representing the ID of this plan in the database
  4.  
  5. $version - Integer: (OPTIONAL) The version of the text you want returned.
  6. Defaults to the latest.
  7.  
  8. Returns: Hash: Text and author information.
  9.  
  10. Example:
  11. # Get all latest case text
  12. >>> TestPlan.get_text(137)
  13. # Get all case text with version 4
  14. >>> TestPlan.get_text(137,4)

TestPlan.import_case_via_XML

  1. Description: Add cases to plan via XML file
  2.  
  3. Params: $plan_id - Integer: A single TestPlan ID.
  4.  
  5. $values - String: String which read from XML file object.
  6.  
  7. Returns: String: Success update cases
  8.  
  9. Example:
  10. # Update product to 61 for plan 207 and 208
  11. >>> fb = open('tcms.xml','rb')
  12. >>> TestPlan.import_case_via_XML(3798,fb.read())

TestPlan.lookup_type_id_by_name

  1. DEPRECATED - CONSIDERED HARMFUL Use TestPlan.check_plan_type instead

TestPlan.lookup_type_name_by_id

  1. DEPRECATED - CONSIDERED HARMFUL Use TestPlan.get_plan_type instead

TestPlan.remove_component

  1. Description: Removes selected component from the selected test plan.
  2.  
  3. Params: $plan_ids - Integer/Array/String: An integer representing the ID in the database,or a string of comma separated plan_ids.
  4.  
  5. $component_ids - Integer: - The component ID to be removed.
  6.  
  7. Returns: Array: Empty on success.
  8.  
  9. Example:
  10. # Remove component id 54321 from plan 1234
  11. >>> TestPlan.remove_component(1234,5678] from plan list [56789,12345]
  12. >>> TestPlan.remove_component([56789,5678' from plan list '56789,12345' with String
  13. >>> TestPlan.remove_component('56789,5678')

TestPlan.remove_tag

  1. Description: Remove a tag from a plan.
  2.  
  3. Params: $plan_ids - Integer/Array/String: An integer or alias representing the ID in the database,or a string of comma separated plan_ids.
  4.  
  5. $tag - String - A single tag to be removed.
  6.  
  7. Returns: Array: Empty on success.
  8.  
  9. Example:
  10. # Remove tag 'foo' from plan 1234
  11. >>> TestPlan.remove_tag(1234,'foo')
  12. # Remove tag 'foo' and 'bar' from plan list [56789,12345]
  13. >>> TestPlan.remove_tag([56789,'bar'])
  14. # Remove tag 'foo' and 'bar' from plan list '56789,12345' with String
  15. >>> TestPlan.remove_tag('56789,bar')

TestPlan.store_text

  1. Description: Update the document field of a plan.
  2.  
  3. Params: $plan_id - Integer: An integer representing the ID of this plan in the database.
  4. $text - String: Text for the document. Can contain HTML.
  5. [$author] = Integer: (OPTIONAL) The numeric ID or the login of the author.
  6. Defaults to logged in user.
  7.  
  8. Returns: Hash: The new text object hash.
  9.  
  10. Example:
  11. >>> TestPlan.store_text(1234,'Plan Text',2207)

TestPlan.update

  1. Description: Updates the fields of the selected test plan.
  2.  
  3. Params: $plan_ids - Integer: A single TestPlan ID.
  4.  
  5. $values - Hash of keys matching TestPlan fields and the new values
  6. to set each field to.
  7. +-------------------------------------------+----------------+--------------------------------------------+
  8. | Field | Type | Description |
  9. +-------------------------------------------+----------------+--------------------------------------------+
  10. | product | Integer | ID of product |
  11. | name | String | |
  12. | type | Integer | ID of plan type |
  13. | product_version(default_product_version) | Integer | ID of version,|
  14. | | | default_product_version will be deprecated |
  15. | | | in future release. |
  16. | owner | String/Integer | user_name/user_id |
  17. | parent | Integer | Parent plan ID |
  18. | is_active | Boolean | True/False |
  19. | env_group | Integer | |
  20. +-------------------------+----------------+--------------------------------------------------------------+
  21.  
  22. Returns: Hash: The updated test plan object.
  23.  
  24. Example:
  25. # Update product to 61 for plan 207 and 208
  26. >>> TestPlan.update([207,208],{'product': 61})

TestRun.add_cases

  1. Description: Add one or more cases to the selected test runs.
  2.  
  3. Params: $run_ids - Integer/Array/String: An integer representing the ID in the database
  4. an array of IDs,or a comma separated list of IDs.
  5.  
  6. $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.
  7.  
  8. Returns: Array: empty on success or an array of hashes with failure
  9. codes if a failure occured.
  10.  
  11. Example:
  12. # Add case id 54321 to run 1234
  13. >>> TestRun.add_cases(1234,54321)
  14. # Add case ids list [1234,5678] to run list [56789,12345]
  15. >>> TestRun.add_cases([56789,5678])
  16. # Add case ids list '1234,5678' to run list '56789,12345' with String
  17. >>> TestRun.add_cases('56789,5678')

TestRun.add_tag

  1. Description: Add one or more tags to the selected test runs.
  2.  
  3. Params: $run_ids - Integer/Array/String: An integer representing the ID in the database,an arry of run_ids,or a string of comma separated run_ids.
  4.  
  5. $tags - String/Array - A single tag,or a comma separated list of tags.
  6.  
  7. Returns: Array: empty on success or an array of hashes with failure
  8. codes if a failure occured.
  9.  
  10. Example:
  11. # Add tag 'foobar' to run 1234
  12. >>> TestPlan.add_tag(1234,'bar'] to run list [12345,bar')

TestRun.create

  1. Description: Creates a new Test Run object and stores it in the database.
  2.  
  3. Params: $values - Hash: A reference to a hash with keys and values
  4. matching the fields of the test run to be created.
  5. +-------------------+----------------+-----------+---------------------------------------+
  6. | Field | Type | Null | Description |
  7. +-------------------+----------------+-----------+---------------------------------------+
  8. | plan | Integer | required | ID of test plan |
  9. | build | Integer/String | required | ID of Build |
  10. | errata_id | Integer | Optional | ID of Errata |
  11. | manager | Integer | required | ID of run manager |
  12. | summary | String | required | |
  13. | product | Integer | required | ID of product |
  14. | product_version | Integer | required | ID of product version |
  15. | default_tester | Integer | Optional | ID of run default tester |
  16. | plan_text_version | Integer | Optional | |
  17. | estimated_time | String | Optional | 2h30m30s(recommend) or HH:MM:SS Format|
  18. | notes | String | Optional | |
  19. | status | Integer | Optional | 0:RUNNING 1:STOPPED (default 0) |
  20. | case | Array/String | Optional | list of case ids to add to the run |
  21. | tag | Array/String | Optional | list of tag to add to the run |
  22. +-------------------+----------------+-----------+---------------------------------------+
  23.  
  24. Returns: The newly created object hash.
  25.  
  26. Example:
  27. >>> values = {'build': 384,'manager': 137,'plan': 137,'errata_id': 124,'product_version': 93,'summary': 'Testing XML-RPC for TCMS',}
  28. >>> TestRun.create(values)

TestRun.env_value

  1. Description: add/remove env values to the given runs,function is same as link_env_value/unlink_env_value
  2.  
  3. Params: $action - String: 'add' or 'remove'.
  4. $run_ids - Integer/Array/String: An integer representing the ID in the database,an array of run_ids,or a string of comma separated run_ids.
  5.  
  6. $env_value_ids - Integer/Array/String: An integer representing the ID in the database,an array of env_value_ids,or a string of comma separated env_value_ids.
  7.  
  8. Returns: Array: empty on success or an array of hashes with failure
  9. codes if a failure occured.
  10.  
  11. Example:
  12. # Add env value 13 to run id 8748
  13. >>> TestRun.env_value('add',8748,13)

TestRun.filter

  1. Description: Performs a search and returns the resulting list of test runs.
  2.  
  3. Params: $values - Hash: keys must match valid search fields.
  4.  
  5. +--------------------------------------------------------+
  6. | Run Search Parameters |
  7. +--------------------------------------------------------+
  8. | Key | Valid Values |
  9. | build | ForeignKey: Build |
  10. | cc | ForeignKey: Auth.User |
  11. | env_value | ForeignKey: Environment Value |
  12. | default_tester | ForeignKey: Auth.User |
  13. | run_id | Integer |
  14. | manager | ForeignKey: Auth.User |
  15. | notes | String |
  16. | plan | ForeignKey: Test Plan |
  17. | summary | String |
  18. | tag | ForeignKey: Tag |
  19. | product_version | ForeignKey: Version |
  20. +--------------------------------------------------------+
  21.  
  22. Returns: Array: Matching test runs are retuned in a list of run object hashes.
  23.  
  24. Example:
  25. # Get all of runs contain 'TCMS' in summary
  26. >>> TestRun.filter({'summary__icontain': 'TCMS'})
  27. # Get all of runs managed by xkuang
  28. >>> TestRun.filter({'manager__username': 'xkuang'})
  29. # Get all of runs the manager name starts with x
  30. >>> TestRun.filter({'manager__username__startswith': 'x'})
  31. # Get runs contain the case ID 12345,34567
  32. >>> TestRun.filter({'case_run__case__case_id__in': [12345,34567]})

TestRun.filter_count

  1. Description: Performs a search and returns the resulting count of runs.
  2.  
  3. Params: $query - Hash: keys must match valid search fields (see filter).
  4.  
  5. Returns: Integer - total matching runs.
  6.  
  7. Example:
  8. # See distinct_count()

TestRun.get

  1. Description: Used to load an existing test run from the database.
  2.  
  3. Params: $run_id - Integer: An integer representing the ID of the run
  4. in the database
  5.  
  6. Returns: Hash: A blessed TestRun object hash
  7.  
  8. Example:
  9. >>> TestRun.get(1193)

TestRun.get_bugs

  1. *** FIXME: BUGGY IN SERIALISER - List can not be serialize. ***
  2. Description: Get the list of bugs attached to this run.
  3.  
  4. Params: $run_ids - Integer/Array/String: An integer representing the ID in the database
  5. an array of integers or a comma separated list of integers.
  6.  
  7. Returns: Array: An array of bug object hashes.
  8.  
  9. Example:
  10. # Get bugs belong to ID 12345
  11. >>> TestRun.get_bugs(12345)
  12. # Get bug belong to run ids list [12456,23456]
  13. >>> TestRun.get_bugs([12456,23456])
  14. # Get bug belong to run ids list 12456 and 23456 with string
  15. >>> TestRun.get_bugs('12456,23456')

@L_385_301@

  1. *** FIXME: NOT IMPLEMENTED - History is different than before ***
  2. Description: Get the list of changes to the fields of this run.
  3.  
  4. Params: $run_id - Integer: An integer representing the ID of the run in the database
  5.  
  6. Returns: Array: An array of hashes with changed fields and their details.

TestRun.get_completion_report

  1. *** FIXME: NOT IMPLEMENTED ***
  2. Description: Get a report of the current status of the selected runs combined.
  3.  
  4. Params: $runs - Integer/Array/String: An integer representing the ID in the database
  5. an array of integers or a comma separated list of integers.
  6.  
  7. Returns: Hash: A hash containing counts and percentages of the combined totals of
  8. case-runs in the run. Counts only the most recently statused case-run
  9. for a given build and environment.

TestRun.get_env_values

  1. Description: Get the list of env values to this run.
  2.  
  3. Params: $run_id - Integer: An integer representing the ID of the run in the database
  4.  
  5. Returns: Array: An array of tag object hashes.
  6.  
  7. Example:
  8. >>> TestRun.get_env_values(8748)

TestRun.get_tags

  1. Description: Get the list of tags attached to this run.
  2.  
  3. Params: $run_id - Integer: An integer representing the ID of the run in the database
  4.  
  5. Returns: Array: An array of tag object hashes.
  6.  
  7. Example:
  8. >>> TestRun.get_tags(1193)

TestRun.get_test_case_runs

  1. Description: Get the list of cases that this run is linked to.
  2.  
  3. Params: $run_id - Integer: An integer representing the ID in the database
  4. for this run.
  5.  
  6. Returns: Array: An array of test case-run object hashes.
  7.  
  8. Example:
  9. # Get all of case runs
  10. >>> TestRun.get_test_case_runs(1193)

TestRun.get_test_cases

  1. Description: Get the list of cases that this run is linked to.
  2.  
  3. Params: $run_id - Integer: An integer representing the ID in the database
  4. for this run.
  5.  
  6. Returns: Array: An array of test case object hashes.
  7.  
  8. Example:
  9. >>> TestRun.get_test_cases(1193)

TestRun.get_test_plan

  1. Description: Get the plan that this run is associated with.
  2.  
  3. Params: $run_id - Integer: An integer representing the ID in the database
  4. for this run.
  5.  
  6. Returns: Hash: A plan object hash.
  7.  
  8. Example:
  9. >>> TestRun.get_test_plan(1193)

TestRun.link_env_value

  1. Description: Link env values to the given runs.
  2.  
  3. Params: $run_ids - Integer/Array/String: An integer representing the ID in the database,or a string of comma separated env_value_ids.
  4.  
  5. Returns: Array: empty on success or an array of hashes with failure
  6. codes if a failure occured.
  7.  
  8. Example:
  9. # Add env value 13 to run id 8748
  10. >>> TestRun.link_env_value(8748,13)

TestRun.remove_cases

  1. Description: Remove one or more cases from the selected test runs.
  2.  
  3. Params: $run_ids - Integer/Array/String: An integer representing the ID in the database
  4. an array of IDs,or a string of comma separated case_ids.
  5.  
  6. Returns: Array: empty on success
  7.  
  8. Exception: When any exception is thrown on the server side,it will be
  9. returned as JSON,which contains two items:
  10.  
  11. - status: 1.
  12.  
  13. - message: str,any message specific to the error on the server
  14.  
  15. Example:
  16. # Remove case 54321 from run 1234
  17. TestRun.remove_cases(1234,54321)
  18. # Remove case ids list [1234,5678] from run list [56789,12345]
  19. TestRun.remove_cases([56789,5678])
  20. # Remove case ids list '1234,5678' from run list '56789,12345' with String
  21. TestRun.remove_cases('56789,5678')

TestRun.remove_tag

  1. Description: Remove a tag from a run.
  2.  
  3. Params: $run_ids - Integer/Array/String: An integer or alias representing the ID in the database,or a string of comma separated run_ids.
  4.  
  5. $tag - String - A single tag to be removed.
  6.  
  7. Returns: Array: Empty on success.
  8.  
  9. Example:
  10. # Remove tag 'foo' from run 1234
  11. >>> TestRun.remove_tag(1234,'foo')
  12. # Remove tag 'foo' and 'bar' from run list [56789,12345]
  13. >>> TestRun.remove_tag([56789,'bar'])
  14. # Remove tag 'foo' and 'bar' from run list '56789,12345' with String
  15. >>> TestRun.remove_tag('56789,bar')

TestRun.unlink_env_value

  1. Description: Unlink env values to the given runs.
  2.  
  3. Params: $run_ids - Integer/Array/String: An integer representing the ID in the database,or a string of comma separated env_value_ids.
  4.  
  5. Returns: Array: empty on success or an array of hashes with failure
  6. codes if a failure occured.
  7.  
  8. Example:
  9. # Unlink env value 13 to run id 8748
  10. >>> TestRun.unlink_env_value(8748,13)

TestRun.update

  1. Description: Updates the fields of the selected test run.
  2.  
  3. Params: $run_ids - Integer/Array/String: An integer or alias representing the ID in the database,or a string of comma separated run_ids.
  4.  
  5. $values - Hash of keys matching TestRun fields and the new values
  6. to set each field to. See params of TestRun.create for description
  7. +-------------------+----------------+--------------------------------+
  8. | Field | Type | Description |
  9. +-------------------+----------------+--------------------------------+
  10. | plan | Integer | TestPlan.plan_id |
  11. | product | Integer | Product.id |
  12. | build | Integer | Build.id |
  13. | errata_id | Integer | Errata.id |
  14. | manager | Integer | Auth.User.id |
  15. | default_tester | Intege | Auth.User.id |
  16. | summary | String | |
  17. | estimated_time | TimeDelta | 2h30m30s(recommend) or HH:MM:SS|
  18. | product_version | Integer | |
  19. | plan_text_version | Integer | |
  20. | notes | String | |
  21. | status | Integer | 0:RUNNING 1:FINISHED |
  22. +-------------------+----------------+ -------------------------------+
  23. Returns: Hash: The updated test run object.
  24.  
  25. Example:
  26. # Update status to finished for run 1193 and 1194
  27. >>> TestRun.update([1193,1194],{'status': 1})

Testopia.api_version

  1. Description: Return the API version of Nitrate.

Testopia.log_call

  1. Log XMLRPC-specific invocations
  2.  
  3. This is copied from kobo.django.xmlrpc.decorators to add custom abitlities,so that we don't have to wait upstream to make the changes.
  4.  
  5. Usage::
  6.  
  7. from tcms.core.decorators import log_call
  8. @log_call(namespace='TestNamespace')
  9. def func(request):
  10. return None

Testopia.nitrate_version

  1. Description: Returns the version of Nitrate on this server.

Testopia.tcms_version

  1. Description: Returns the version of Nitrate on this server.

Testopia.testopia_version

  1. Description: Returns the version of Nitrate on this server.

User.filter

  1. Description: Performs a search and returns the resulting list of test cases
  2.  
  3. Params: $query - Hash: keys must match valid search fields.
  4.  
  5. +------------------------------------------------------------------+
  6. | Case Search Parameters |
  7. +------------------------------------------------------------------+
  8. | Key | Valid Values |
  9. | id | Integer: ID |
  10. | username | String: User name |
  11. | first_name | String: User first name |
  12. | last_name | String: User last name |
  13. | email | String Email |
  14. | is_active | Boolean: Return the active users |
  15. | groups | ForeignKey: AuthGroup |
  16. +------------------------------------------------------------------+
  17.  
  18. Returns: Array: Matching test cases are retuned in a list of hashes.
  19.  
  20. Example:
  21. >>> User.filter({'username__startswith': 'x'})

User.get

  1. Description: Used to load an existing test case from the database.
  2.  
  3. Params: $id - Integer/String: An integer representing the ID in the
  4. database
  5.  
  6. Returns: A blessed User object Hash
  7.  
  8. Example:
  9. >>> User.get(2206)

User.get_me

  1. Description: Get the information of myself.
  2.  
  3. Returns: A blessed User object Hash
  4.  
  5. Example:
  6. >>> User.get_me()

User.join

  1. Description: Add user to a group specified by name.
  2.  
  3. Returns: None
  4.  
  5. Raises: PermissionDenied
  6. Object.DoesNotExist
  7.  
  8. Example:
  9. >>> User.join('username','groupname')

User.update

  1. Description: Updates the fields of the selected user. it also can change
  2. the informations of other people if you have permission.
  3.  
  4. Params: $values - Hash of keys matching TestCase fields and the new
  5. values to set each field to.
  6.  
  7. $id - Integer/String(Optional)
  8. Integer: A single TestCase ID.
  9. String: A comma string of User ID.
  10. Default: The ID of myself
  11.  
  12. Returns: A blessed User object Hash
  13.  
  14. +--------------+--------+-----------------------------------------+
  15. | Field | Type | Null |
  16. +--------------+--------+-----------------------------------------+
  17. | first_name | String | Optional |
  18. | last_name | String | Optional(required if changes category) |
  19. | email | String | Optional |
  20. | password | String | Optional |
  21. | old_password | String | required by password |
  22. +--------------+--------+-----------------------------------------+
  23.  
  24. Example:
  25. >>> User.update({'first_name': 'foo'})
  26. >>> User.update({'password': 'foo','old_password': '123'})
  27. >>> User.update({'password': 'foo','old_password': '123'},2206)

Version.get

  1. Description: Retrieve XMLRPC's version
  2.  
  3. Params: No parameters.
  4.  
  5. Returns: A list that represents the version.
  6.  
  7. Example:
  8. Version.get()

猜你在找的XML相关文章