createTestCase(self, *argsPositional, **argsOptional)
"""
positional args: testcasename, testsuiteid, testprojectid, authorlogin,
summary
optional args : steps, preconditions, importance, executiontype, order,
internalid, checkduplicatedname,
actiononduplicatedname,
status, estimatedexecduration
argument 'steps' will be set with values from .stepsList,
- when argsOptional does not include a 'steps' item
- .stepsList can be filled before call via .initStep() and .appendStep()
otherwise, optional arg 'steps' must be defined as a list with
dictionaries , example
[{'step_number' : 1, 'actions' : "action A" ,
'expected_results' : "result A", 'execution_type' : 0},
{'step_number' : 2, 'actions' : "action B" ,
'expected_results' : "result B", 'execution_type' : 1},
{'step_number' : 3, 'actions' : "action C" ,
'expected_results' : "result C", 'execution_type' : 0}]
"""
这段官方描述介绍了创建用例需要的参数。argsPositional中可以传递用例名,用例集Id,项目Id,登陆用户账号,描述
argsOptional中存放步骤,前置条件,严重等级,执行类型,顺序,?,检查名称是否重复,步骤名称仇富,状态,执行时间
其中step必须以list中嵌套dict的形式传递。steps也可以通过先调用initStep()和appendStep()来传递
通过steps来传递
import testlink
url = "http://testlink.wanqian.store/lib/api/xmlrpc/v1/xmlrpc.php"
key = "084aec4c7fe80e871988886aba8da28e"
tlc = testlink.TestlinkAPIClient(url, key)
projects = tlc.getProjects() # 统计工程数
print tlc.getFirstLevelTestSuitesForTestProject(projects[0])
steps = [{"step_number": 1, "action": "step1", "expected_results": "resultA", "execution_type": 0}]
tlc.createTestCase("python-testlink-step", 2, 1, "ziya", "dfasdf", steps=steps)
通过initStep来添加步骤
import testlink
url = "http://testlink.wanqian.store/lib/api/xmlrpc/v1/xmlrpc.php"
key = "084aec4c7fe80e871988886aba8da28e"
tlc = testlink.TestlinkAPIClient(url, key)
projects = tlc.getProjects() # 统计工程数
print tlc.getFirstLevelTestSuitesForTestProject(projects[0])
tlc.initStep("ddd", "eeeee", 0) # 添加步骤
tlc.createTestCase("python-testlink-step", 2, 1, "ziya", "dfasdf")
网友评论