deepin@deepin-pc:~/test$ cat libclienttestlink.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*- #! /usr/bin/python
#
# Testlink API Sample Python 3.1.2 getProjects() - Client implementation
#
import xmlrpc.client class TestlinkAPIClient:
# substitute your server URL Here
SERVER_URL = "https://******************************/xmlrpc.php" def __init__(self):
self.server = xmlrpc.client.ServerProxy(self.SERVER_URL)
self.devKey = "your user key" def getInfo(self):
return self.server.tl.about() def getProjects(self):
return self.server.tl.getProjects(dict(devKey=self.devKey)) def getClientTL(self):
return self.server.tl client = TestlinkAPIClient()
tlclient = client.getClientTL() args = {}
args["devKey"] = client.devKey
args["testplanname"] = "pythontest"
args["testprojectname"] = "LSTest" client = TestlinkAPIClient()
tlclient = client.getClientTL() print(client.getInfo())
print("-" * 80)
print(tlclient.getTestPlanByName(args))

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

输出结果:

 deepin@deepin-pc:~/test$ python3 libclienttestlink.py
Testlink API Version: 1.0 initially written by Asiel Brumfield
with contributions by TestLink development Team
--------------------------------------------------------------------------------
[{'name': 'pythontest', 'is_public': '', 'testproject_id': '', 'notes': '', 'is_open': '', 'id': '', 'api_key': 'c48e5b0e375c13c847b4148fcf4e283615619e52b427c11ff023e4a7d9b78bd1', 'active': ''}]
deepin@deepin-pc:~/test$

未完待续

Testlink源代码链接:

https://github.com/TestLinkOpenSourceTRMS/testlink-code/blob/5bb8e574ecc4adca5664437ee3a80c9e8d7c434d/lib/api/xmlrpc/v1/xmlrpc.class.php

'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'

Testlink接口使用方法-python语言远程调用的更多相关文章

  1. 使用Socket&反射&Java流操作进行方法的远程调用(模拟RPC远程调用)

    写在前面 阅读本文首先得具备基本的Socket.反射.Java流操作的基本API使用知识:否则本文你可能看不懂... 服务端的端口监听 进行远程调用,那就必须得有客户端和服务端.服务端负责提供服务,客 ...

  2. python web自动化测试框架搭建(功能&接口)——接口公共方法

    接口公共方法有:数据引擎.http引擎.Excel引擎 1.数据引擎:获取用例.结果检查.结果统计 # -*- coding:utf-8 -*- from XlsEngine import XlsEn ...

  3. [转载] 基于Dubbo的Hessian协议实现远程调用

    转载自http://shiyanjun.cn/archives/349.html Dubbo基于Hessian实现了自己Hessian协议,可以直接通过配置的Dubbo内置的其他协议,在服务消费方进行 ...

  4. 架构设计:一种远程调用服务的设计构思(zookeeper的一种应用实践)

    在深入学习zookeeper我想先给大家介绍一个和zookeeper相关的应用实例,我把这个实例命名为远程调用服务.通过对这种应用实例的描述,我们会对zookeeper应用场景会有深入的了解. 远程调 ...

  5. JSON-RPC轻量级远程调用协议介绍及使用

    这个项目能够帮助开发人员利用Java编程语言轻松实现JSON-RPC远程调用.jsonrpc4j使用Jackson类库实现Java对象与JSON对象之间的相互转换.jsonrpc4j包含一个JSON- ...

  6. 【Java EE 学习 78 中】【数据采集系统第十天】【Spring远程调用】

    一.远程调用概述 1.远程调用的定义 在一个程序中就像调用本地中的方法一样调用另外一个远程程序中的方法,但是整个过程对本地完全透明,这就是远程调用.spring已经能够非常成熟的完成该项功能了. 2. ...

  7. Hessian怎样实现远程调用

    1.Spring中除了提供HTTP调用器方式的远程调用,还对第三方的远程调用实现提供了支持,其中提供了对Hessian的支持. Hessian是由Caocho公司发布的一个轻量级的二进制协议远程调用实 ...

  8. 《Spring技术内幕》学习笔记17——Spring HTTP调用器实现远程调用

    1.Spring中,HTTPInvoker(HTTP调用器)是通过基于HTTP协议的分布式远程调用解决方案,和java RMI一样,HTTP调用器也需要使用java的对象序列化机制完成客户端和服务器端 ...

  9. JSON-RPC远程调用协议

    1. JSON-RPC简介 2. 请求 3. 响应 4. 错误 4.1. 错误对象 4.2. 错误码 5. 批量调用 6. 示例 6.1. 列表形式参数 6.2. key-value形式参数 6.3. ...

随机推荐

  1. SCU 4436 Easy Math 2015年四川省赛题

    题目链接:http://acm.scu.edu.cn/soj/problem/4436/ 题意:给你n个整数,求这n个数的平方根和是否是一个整数: 解题思路:如果这题每个数给他算出来,必然费时间,可能 ...

  2. 如何更改项目所使用的C#版本

  3. base64 小测试:

    base64工作原理:Base64是MIME邮件中常用的编码方式之一.它的主要思想是将输入的字符串或数据编码成只含有{'A'-'Z', 'a'-'z', '0'-'9', '+', '/'}这64个可 ...

  4. POJ 3978 Primes(求范围素数个数)

    POJ 3978 Primes(求范围素数个数) id=3978">http://poj.org/problem? id=3978 题意: 给你一个区间范围A和B,要你求出[A,B]内 ...

  5. CSU1661: Query Mutiple

    Description One day,Little-Y saw many numbers standing in a row. A question suddenly appeared in her ...

  6. [转] boost.circular_buffer简介

    http://www.cnblogs.com/TianFang/archive/2013/02/05/2892503.html 很多时候,我们需要在内存中记录最近一段时间的数据,如操作记录等.由于这部 ...

  7. SpringMVC中文乱码

    刚刚构建的SpringMVC项目,一般都是中文乱码的. 这时的工程就是一个JSP页面的事情,可以添加如下代码 <%@ page language="java" import= ...

  8. Linux 基本命令(持续更新ing)

    cd -> 变换路径                        //文件一般存在/var/路径下,var为可修改存储盘 ls -> 列出所有隐藏文件与相关文件的属性   #ls -al ...

  9. BeautifulSoup在Windows下安装(running 2to3)

    在windows下安装beautifulsoup经常会出现说是在python3下无法运行Python2的代码,这时需要将Python下的tool下的scripts目录添加到环境变量中,然后运行2to3 ...

  10. Python之路,Day12 - 那就做个堡垒机吧

    Python之路,Day12 - 那就做个堡垒机吧   本节内容 项目实战:运维堡垒机开发 前景介绍 到目前为止,很多公司对堡垒机依然不太感冒,其实是没有充分认识到堡垒机在IT管理中的重要作用的,很多 ...