python调用远程接口_Testlink接口使用方法-python语言远程调用

1 deepin@deepin-pc:~/test$ cat libclienttestlink.py2 #!/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 importxmlrpc.client10

11 classTestlinkAPIClient: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 defgetInfo(self):20 returnself.server.tl.about()21

22 defgetProjects(self):23 return self.server.tl.getProjects(dict(devKey=self.devKey))24

25 defgetClientTL(self):26 returnself.server.tl27

28 client =TestlinkAPIClient()29 tlclient =client.getClientTL()30

31 args ={}32 args["devKey"] =client.devKey33 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))

把代码中变量设置为本地环境后就可以实现远程调用Testlink了。

输出结果:

1 deepin@deepin-pc:~/test$ python3 libclienttestlink.py2 Testlink API Version: 1.0initially written by Asiel Brumfield3 with contributions by TestLink development Team4 --------------------------------------------------------------------------------

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$

未完待续

Testlink源代码链接:

'tl.reportTCResult' => 'this:reportTCResult',

'tl.setTestCaseExecutionResult' => 'this:reportTCResult',

'tl.createBuild' => 'this:createBuild',

'tl.createPlatform' => 'this:createPlatform',

'tl.createTestCase' => 'this:createTestCase',

'tl.createTestCaseSteps' => 'this:createTestCaseSteps',

'tl.createTestPlan' => 'this:createTestPlan',

'tl.createTestProject' => 'this:createTestProject',

'tl.createTestSuite' => 'this:createTestSuite',

'tl.deleteTestCaseSteps' => 'this:deleteTestCaseSteps',

'tl.deleteTestPlan' => 'this:deleteTestPlan',

'tl.deleteTestProject' => 'this:deleteTestProject',

'tl.uploadExecutionAttachment' => 'this:uploadExecutionAttachment',

'tl.uploadRequirementSpecificationAttachment' => 'this:uploadRequirementSpecificationAttachment',

'tl.uploadRequirementAttachment' => 'this:uploadRequirementAttachment',

'tl.uploadTestProjectAttachment' => 'this:uploadTestProjectAttachment',

'tl.uploadTestSuiteAttachment' => 'this:uploadTestSuiteAttachment',

'tl.uploadTestCaseAttachment' => 'this:uploadTestCaseAttachment',

'tl.uploadAttachment' => 'this:uploadAttachment',

'tl.assignRequirements' => 'this:assignRequirements',

'tl.addTestCaseToTestPlan' => 'this:addTestCaseToTestPlan',

'tl.addPlatformToTestPlan' => 'this:addPlatformToTestPlan',

'tl.removePlatformFromTestPlan' => 'this:removePlatformFromTestPlan',

'tl.getExecCountersByBuild' => 'this:getExecCountersByBuild',

'tl.getIssueTrackerSystem' => 'this:getIssueTrackerSystem',

'tl.getProjects' => 'this:getProjects',

'tl.getProjectKeywords' => 'this:getProjectKeywords',

'tl.getProjectTestPlans' => 'this:getProjectTestPlans',

'tl.getTestCaseAssignedTester' => 'this:getTestCaseAssignedTester',

'tl.getTestCaseBugs' => 'this:getTestCaseBugs',

'tl.getTestCaseKeywords' => 'this:getTestCaseKeywords',

'tl.getTestProjectByName' => 'this:getTestProjectByName',

'tl.getTestPlanByName' => 'this:getTestPlanByName',

'tl.getTestPlanPlatforms' => 'this:getTestPlanPlatforms',

'tl.getTotalsForTestPlan' => 'this:getTotalsForTestPlan',

'tl.getBuildsForTestPlan' => 'this:getBuildsForTestPlan',

'tl.getLatestBuildForTestPlan' => 'this:getLatestBuildForTestPlan',

'tl.getLastExecutionResult' => 'this:getLastExecutionResult',

'tl.getTestSuitesForTestPlan' => 'this:getTestSuitesForTestPlan',

'tl.getTestSuitesForTestSuite' => 'this:getTestSuitesForTestSuite',

'tl.getTestCasesForTestSuite' => 'this:getTestCasesForTestSuite',

'tl.getTestCasesForTestPlan' => 'this:getTestCasesForTestPlan',

'tl.getTestCaseIDByName' => 'this:getTestCaseIDByName',

'tl.getTestCaseCustomFieldDesignValue' => 'this:getTestCaseCustomFieldDesignValue',

'tl.getTestCaseCustomFieldExecutionValue' => 'this:getTestCaseCustomFieldExecutionValue',

'tl.getTestCaseCustomFieldTestPlanDesignValue' => 'this:getTestCaseCustomFieldTestPlanDesignValue',

'tl.getTestSuiteCustomFieldDesignValue' => 'this:getTestSuiteCustomFieldDesignValue',

'tl.getTestPlanCustomFieldDesignValue' => 'this:getTestPlanCustomFieldDesignValue',

'tl.getReqSpecCustomFieldDesignValue' => 'this:getReqSpecCustomFieldDesignValue',

'tl.getRequirementCustomFieldDesignValue' => 'this:getRequirementCustomFieldDesignValue',

'tl.getFirstLevelTestSuitesForTestProject' => 'this:getFirstLevelTestSuitesForTestProject',

'tl.getTestCaseAttachments' => 'this:getTestCaseAttachments',

'tl.getTestCase' => 'this:getTestCase',

'tl.getFullPath' => 'this:getFullPath',

'tl.getTestSuiteByID' => 'this:getTestSuiteByID',

'tl.getUserByLogin' => 'this:getUserByLogin',

'tl.getUserByID' => 'this:getUserByID',

'tl.deleteExecution' => 'this:deleteExecution',

'tl.doesUserExist' => 'this:doesUserExist',

'tl.updateTestCaseCustomFieldDesignValue' => 'this:updateTestCaseCustomFieldDesignValue',

'tl.updateTestCase' => 'this:updateTestCase',

'tl.setTestCaseExecutionType' => 'this:setTestCaseExecutionType',

'tl.assignTestCaseExecutionTask' => 'this:assignTestCaseExecutionTask',

'tl.unassignTestCaseExecutionTask' => 'this:unassignTestCaseExecutionTask',

'tl.addTestCaseKeywords' => 'this:addTestCaseKeywords',

'tl.removeTestCaseKeywords' => 'this:removeTestCaseKeywords',

'tl.updateTestSuiteCustomFieldDesignValue' => 'this:updateTestSuiteCustomFieldDesignValue',

'tl.getTestSuite' => 'this:getTestSuite',

'tl.checkDevKey' => 'this:checkDevKey',

'tl.about' => 'this:about',

'tl.testLinkVersion' => 'this:testLinkVersion',

'tl.setTestMode' => 'this:setTestMode',

'tl.ping' => 'this:sayHello',

'tl.sayHello' => 'this:sayHello',

'tl.repeat' => 'this:repeat'

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值