tcms_api package¶
This module provides a dictionary based Python interface for the Kiwi TCMS test management system. It operates via the XML-RPC protocol.
Installation:
pip install tcms-api
If you want to use Kerberos then:
pip install tcms-api[gssapi]
WARNING: on Windows you need to install MIT Kerberos and make sure
C:\Program Files\MIT\Kerberos\bin is included in %PATH% -
this is usually the case when you install and restart! It must be
a 64bit installation, see
MIT Kerberos for Windows 4.1
WARNING: on Linux you will need gcc, Python and kerberos devel packages to
build gssapi because it doesn’t provide binary packages via PyPI. Try
dnf install gcc krb5-devel python3-devel (Red Hat/Fedora) or
apt-get install gcc libkrb5-dev libpython3-dev (Debian/Ubuntu).
Minimal config file ~/.tcms.conf:
[tcms]
url = https://tcms.server/xml-rpc/
username = your-username
password = your-password
For Kerberos specify the use_kerberos = True key without username
and password! Also make sure that your /etc/krb5.conf contains:
[libdefaults]
default_realm = .EXAMPLE.COM
where EXAMPLE.COM matches the realm in your organization.
Important
The filename ~/.tcms.conf is expanded to something like
/home/tcms-bot/.tcms.conf on Linux and
C:\Users\tcms-bot\.tcms.conf on Windows, where tcms-bot
is the username on the local computer.
It’s also possible to provide system-wide config in /etc/tcms.conf
on Linux and C:\tcms.conf on Windows!
Execute the following Python snippet to find the exact location on your system:
import os
print(os.path.expanduser('~/.tcms.conf'))
Connect to backend:
from tcms_api import TCMS
rpc = TCMS().exec
for test_case in rpc.TestCase.filter({'pk': 46490}):
print(test_case)
After tcms-api v13.2 you can pass connection configuration directly as arguments when initializing the TCMS() class:
TCMS("https://kiwitcms.example.com/xml-rpc/", "api-bot", "keep-me-secret").exec
Important
For a list of available RPC methods see https://kiwitcms.readthedocs.io/en/latest/modules/tcms.rpc.api.html
Example(s) and API scripts contributed by the Kiwi TCMS community can be found at https://github.com/kiwitcms/api-scripts. You are welcome to open a pull request with your own examples!
- class tcms_api.TCMS(url=None, username=None, password=None)[source]¶
Bases:
objectTakes care of initiating the connection to the TCMS server and parses user configuration using a utilities class!
- property exec¶
Property that returns the underlying XML-RPC connection on which you can call various server-side functions.
Important
Call this property once and assign it to a temporary variable as shown in the examples above. Then use the
rpcvariable to access the different RPC methods!Starting with tcms-api v12.9.1 this property is automatically refreshed every 4 minutes to avoid SSL connection timeout errors!
Submodules¶
- tcms_api.plugin_helpers module
BackendBackend.add_comment()Backend.add_test_case_to_plan()Backend.add_test_case_to_run()Backend.configure()Backend.created_by_textBackend.default_tester_idBackend.external_plan_id()Backend.finish_test_run()Backend.get_build_id()Backend.get_plan_id()Backend.get_plan_type_id()Backend.get_product_id()Backend.get_run_id()Backend.get_status_id()Backend.get_status_id_fallback()Backend.get_statuses_by_weight()Backend.get_version_id()Backend.log_info()Backend.nameBackend.prefixBackend.test_case_get_or_create()Backend.update_test_execution()Backend.version
- tcms_api.version module
- tcms_api.xmlrpc module