您的位置:軟件測(cè)試 > 開(kāi)源軟件測(cè)試 > 開(kāi)源測(cè)試管理工具 > Testlink
Testlink接口使用方法-python語(yǔ)言遠(yuǎn)程調(diào)用
作者:網(wǎng)絡(luò)轉(zhuǎn)載 發(fā)布時(shí)間:[ 2016/7/20 11:10:39 ] 推薦標(biāo)簽:測(cè)試管理工具 Testlink

1 deepin@deepin-pc:~/test$ cat libclienttestlink.py
2 #!/usr/bin/env python3
3 # -*- coding: utf-8 -*-
4
5 #! /usr/bin/python
6 #
7 # Testlink API Sample Python 3.1.2 getProjects() - Client implementation
8 #
9 import xmlrpc.client
10
11 class TestlinkAPIClient:
12     # substitute your server URL Here
13     SERVER_URL = "https://******************************/xmlrpc.php"
14
15     def __init__(self):
16         self.server = xmlrpc.client.ServerProxy(self.SERVER_URL)
17         self.devKey = "your user key"
18
19     def getInfo(self):
20         return self.server.tl.about()
21
22     def getProjects(self):
23         return self.server.tl.getProjects(dict(devKey=self.devKey))
24
25     def getClientTL(self):
26         return self.server.tl
27
28 client = TestlinkAPIClient()
29 tlclient = client.getClientTL()
30
31 args = {}
32 args["devKey"] = client.devKey
33 args["testplanname"] = "pythontest"
34 args["testprojectname"] = "LSTest"
35
36 client = TestlinkAPIClient()
37 tlclient = client.getClientTL()
38
39 print(client.getInfo())
40 print("-" * 80)
41 print(tlclient.getTestPlanByName(args))
  把代碼中變量設(shè)置為本地環(huán)境后可以實(shí)現(xiàn)遠(yuǎn)程調(diào)用Testlink了。
  輸出結(jié)果:
1 deepin@deepin-pc:~/test$ python3 libclienttestlink.py
2  Testlink API Version: 1.0 initially written by Asiel Brumfield
3  with contributions by TestLink development Team
4 --------------------------------------------------------------------------------
5 [{'name': 'pythontest', 'is_public': '1', 'testproject_id': '56567', 'notes': '', 'is_open': '1', 'id': '56582', 'api_key': 'c48e5b0e375c13c847b4148fcf4e283615619e52b427c11ff023e4a7d9b78bd1', 'active': '1'}]
6 deepin@deepin-pc:~/test$

上一頁(yè)12下一頁(yè)
軟件測(cè)試工具 | 聯(lián)系我們 | 投訴建議 | 誠(chéng)聘英才 | 申請(qǐng)使用列表 | 網(wǎng)站地圖
滬ICP備07036474 2003-2017 版權(quán)所有 上海澤眾軟件科技有限公司 Shanghai ZeZhong Software Co.,Ltd