TestLink-API-Python-client
Whisper Lv5

case的数据结构:一个内部ID,一个外部ID,源码中的ID一般为内部ID

1
2
3
{'id': '14158', 'name': '页面标题显示为:新增', 'parent_id':
'14087', 'tsuite_name': '新增币种弹窗', 'tc_external_id':
'288'}

testlinkapi.py 主要

getTestCaseIDByName : Find a test case by its name 位置参数:casename

1
2
3
[{'id': '14158', 'name': '页面标题显示为:新增', 'parent_id':
'14087', 'tsuite_name': '新增币种弹窗', 'tc_external_id':
'288'}]

createTestCase:Create a test case
getProjectIDByNode: 返回当前node id对应是哪个项目ID
copyTCnewVersion: 为测试用例创建一个新版本
getTestCaseByVersion(self, testCaseID, version=None): Gets
testcaseinformation based on the version.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
"updater_login": "",
author_login": "luna",
"name": "页面标题显示为:新增",
"node_order": "0",
"testsuite_id": "14087",
"testcase_id": "14158",
"id": "14159",
"tc_external_id": "288",
"version": "1",
"layout": "1",
"status": "1",
"summary": "",
"preconditions": "",
"importance": "1",
"author_id": "2",
"creation_ts": "2021-06-07 06:30:59",
"updater_id": "",
"modification_ts": "2021-06-07 06:30:59",
"active": "1",
"is_open": "1",
"execution_type": "1",
"estimated_exec_duration": "",
"author_first_name": "测试",
"author_last_name": "Luna",
"updater_first_name": "",
"updater_last_name": "",
"steps": "",
"full_tc_external_id": "yx-288"
}

listKeywordsForTC(self, internal_or_external_tc_id):Returns list with keyword for a test case

现在首页创建关键字,然后分配给某用例,然后才能获取该用例的关键字列表

['测试关键字A', '测试关键字B']

listKeywordsForTS(self, internal_ts_id):Returns dictionary with keyword
listsfor all test cases of test suite with id == INTERNAL_TS_ID

1
2
3
{'10775': ['测试关键字A', '测试关键字B'], '10779': [],
'10782': [], '10787': [], '10792': [], '10797': [],
'10802': [], '10807': []}
1
2
3
4
5
6
7
8
9
10
11
countProjects(self): Count all the test project
countTestPlans(self):Count all the test plans
countTestSuites(self): Count all the test suites
countTestCasesTP(self):Count all the test cases linked to a Test Plan
countTestCasesTS(self):Count all the test cases linked to a Test Suite
countPlatforms(self):  Count all the Platforms in TestPlans
listProjects(self): Lists the Projects (display Name & ID)
initStep(self, actions, expected_results, execution_type): Initializes the list which stores the Steps of a Test Case to create
appendStep(self, actions, expected_results, execution_type): Appends a
step tothe steps list
getProjectIDByName(self, projectName):

testlinkapigeneric.py

addTestCaseKeywords(self): adds list of keywords to a set of test cases,期望参数 a dictionary with  (外部ID) as a key and  as valueexample:

1
2
3
{'TC-4711' : ['KeyWord02'], 
'TC-4712' :['KeyWord01', KeyWord03']
}

adds to test case ‘TC-4711’ the keyword ‘KeyWord02’adds to test case ‘TC-4712’ the keywords ‘KeyWord01’ + KeyWord03’

1
2
a = {"auto-68": ["测试关键字A"]}
print(ts.tlc.addTestCaseKeywords(a))

输出:

1
{'validKeywords': {'auto-68': {'1': '测试关键字A'}}, 'status_ok': True}