/TestLink-API-Python-client

A Python client to use the TestLink API

Primary LanguagePython

TestLink API Python Client

Copyright 2011-2017 James Stock, Olivier Renault, Luiko Czub, TestLink-API-Python-client developers

License Apache License 2.0

https://travis-ci.org/lczub/TestLink-API-Python-client.svg?branch=master

TestLink-API-Python-client is a Python XML-RPC client for TestLink.

Initially based on James Stock testlink-api-python-client R7 and Olivier Renault JinFeng idea - an interaction of TestLink, Robot Framework and Jenkins.

TestLink-API-Python-client delivers two main classes

  • TestlinkAPIGeneric - Implements the TestLink API methods as generic PY methods with error handling
  • TestlinkAPIClient - Inherits from TestlinkAPIGeneric and defines service methods like "copyTCnewVersion".

and the helper class

  • TestLinkHelper - search connection parameter from environment variables and command line arguments

How to talk with TestLink in a python shell and copy a test case:

set TESTLINK_API_PYTHON_SERVER_URL=http://[YOURSERVER]/testlink/lib/api/xmlrpc/v1/xmlrpc.php
set TESTLINK_API_PYTHON_DEVKEY=[Users devKey generated by TestLink]
python

>>> import testlink
>>> tls = testlink.TestLinkHelper().connect(testlink.TestlinkAPIClient)
>>> tls.countProjects()
3
>>> tc_info = tls.getTestCase(None, testcaseexternalid='NPROAPI-3')
[{'full_tc_external_id': 'NPROAPI-3', ..., 'id': '5440',  'version': '2',
  'testsuite_id': '5415', 'tc_external_id': '3','testcase_id': '5425', ...}]
>>> tls.copyTCnewTestCase(tc_info[0]['testcase_id'], testsuiteid=newSuiteID,
                                         testcasename='a new test case name')
>>> print tls.whatArgs('createTestPlan')
createTestPlan(<testplanname>, <testprojectname>, [note=<note>], [active=<active>],
               [public=<public>], [devKey=<devKey>])
  create a test plan

Install the latest stable release from PyPI using pip by running

pip install testlink-api
src/
Source for TestLink API Python Client
doc/
Installation and Usage documentation
examples/
Examples, how to use TestlinkAPIGeneric and TestlinkAPIClient.
For (nearly all) implemented API methods you find an example, how to call it and how the response looks like.
tests/
Unit Tests for TestLink API Python Client
tox.ini
Configuration for multi Python version testing via Tox

Questions, Enhancements, Issues are welcome under Issues

Take a look into CHANGES.rst for additional details, what have changed and how existing code can be adapted