我通过OTA COM库与质量中心合作。我知道如何连接到服务器,但我迷失在如何使用它的OTA文档中。我需要的是创建一个函数,它以测试名称作为输入,并从QC返回这个测试中的步骤数。 现在我在这个问题上已经走了这么远了。在
import win32com
from win32com.client import Dispatch
# import codecs #to store info in additional codacs
import re
import json
import getpass #for password
qcServer = "***"
qcUser = "***"
qcPassword = getpass.getpass('Password: ')
qcDomain = "***"
qcProject = "***"
td = win32com.client.Dispatch("TDApiOle80.TDConnection.1")
#Starting to connect
td.InitConnectionEx(qcServer)
td.Login(qcUser,qcPassword)
td.Connect(qcDomain, qcProject)
if td.Connected == True:
print "Connected to " + qcProject
else:
print "Connection failed"
#Path = "Subject\Regression\C.001_Band_tones"
mg=td.TreeManager
npath="Subject\Regression"
tsFolder = td.TestSetTreeManager.NodeByPath(npath)
print tsFolder
td.Disconnect
td.Logout
print "Disconnected from " + qcProject
任何有关下降python示例或教程的帮助都将不胜感激。现在我找到了this和{a2},但它们没有帮助。在
使用otaapi从质量中心获取数据通常意味着通过路径获取一些元素,创建一个工厂,然后使用工厂来搜索对象。在您的例子中,您需要TreeManager在测试计划中获取一个文件夹,然后需要TestFactory来获取测试,最后需要DesignStepFactory来获取步骤。我不是Python程序员,但我希望您能从中得到一些东西:
它需要一些时间来适应qcotapi文档,但我发现它非常有用。我几乎所有的知识都来自API文档中针对您的问题的示例,例如“查找唯一测试”或“获取具有名称和路径的测试对象”。这两个示例都是测试对象的示例。即使这些例子是用VB编写的,让它们适应Python也没什么大不了的。在
我想出了解决办法,如果有更好的办法,欢迎你贴出来。在
相关问题 更多 >
编程相关推荐