Python接口访问TestTrackPro SOAP API
项目描述
TestTrack Pro是Seapine Software的问题管理软件
TestTrack是Seapine Software的注册商标。http://www.seapine.com/testtrack.html
这个库使用suds库与TestTrack SDK SOAP API通信,并包括一些有助于管理您的客户端代码和交互的扩展。使用suds与最新的TestTrack SOAP API通信时存在一些问题(和崩溃),这个库解决了这些问题。
虽然这个模块命名为testtrackpro,但它可以与TestTrack RM(需求管理)和TestTrack TCM(测试用例管理)一起使用。
TestTrack SOAP API使用客户端cookie来管理会话。此cookie必须在(几乎)每个API调用中提供。这个库提供了一个客户端包装对象,它将管理会话cookie,甚至在上下文退出时释放cookie(注销)。
TestTrack SOAP API包括实体编辑锁定,其中每个编辑API调用都隐含一个写锁定。客户端必须通过保存或取消保存API调用来释放锁。锁将保持15分钟,使得对实体的其他编辑尝试失败。
Python上下文允许在成功或错误情况下安全释放锁。所有以字符串“edit”开头的API调用返回的对象都将返回一个可以与“with”语句一起使用的上下文对象。在语句块结束时,将执行适当的“save” API调用。如果在块中发生异常,将执行适当的“cancelSave” API调用。在任何情况下,都会释放锁。
import testtrackpro
with testtrackpro.TTP('http://hostname/', 'Project', 'username', 'password') as ttp:
with ttp.editDefect(11, bDownloadAttachments=False) as defect:
defect.priority = "Immediate"
## ttp.saveDefect(defect) is called, or ttp.cancelSave(defect.recordid) on exception.
## ttp.DatabaseLogoff() is called, even if an exception occured.
此外,当使用Python上下文忽略编辑锁错误时,还有一个新的特殊编辑上下文API扩展,当其他人持有实体的编辑锁时。这在您不想脚本或服务因编辑锁失败而出错,而是希望继续处理时非常有用。
import testtrackpro
with testtrackpro.TTP('http://hostname/', 'Project', 'username', 'password') as ttp:
with ttp.editDefect(11, bDownloadAttachments=False, ignoreEditLockError=True) as defect:
defect.priority = "Immediate"
## ttp.saveDefect(defect) is called, or ttp.cancelSave(defect.recordid) on exception.
assert not testtrackpro.have_edit_lock(defect)
if testtrackpro.was_saved(defect):
# The priority was changed
pass
elif testtrackpro.has_errored(defect):
# It was not saved due to an error
pass
if testtrackpro.edit_lock_failed(defect):
# because the edit lock failed
pass
else:
# because of some other error
# NOTE: unless there was other code to catch and ignore the
# error, this code is unreachable.
pass
## ttp.DatabaseLogoff() is called, even if an exception occured.
参考资料
项目
外部
testtrackpro-1.0.1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 7bdfaa9998de7a706c9fb099dfff2fc184315126f56f5649d6ab79e50e5eaf3d |
|
MD5 | 82b8eb23b66fec16fbf72a6705e7e660 |
|
BLAKE2b-256 | bccf9f4f2c360ab51690db7572078265196bb4db6f73623b56b1768b93480a05 |