使用Python读取TestTrack记录- Part1
来源:互联网 发布:centos配置ip地址 编辑:程序博客网 时间:2024/05/30 07:11
background:
注:以下代码均是下班回家之后,凭记忆随手写的工作记录,留作日后查询之用,对准确性概不负责。
开发一个系统,能够实时对TestTrack Server中所有人员的工作量化展现和工作量对比,采用scrum思想开发,本着高内聚低耦合的思想,将系统分为三部分:TTExport + Calc +Website三个模块。
1. TTExport模块,负责导出指定project的某一范围的TT记录,即Defect
- 使用python编写export 脚本,之所以选择python而不是C#,是因为TT里面wsdl中日期类型为date而不是.net中datetime类型,要使用C#只能在TT Server上修改WSDL文件,这样会导致其他语言无法以默认的语法访问TT server,放弃C#,采用python,同时也是逼迫自己学写python
2. Calc模块,使用Linq to xml,计算指定条件下的筛选数值
- 使用Linq to xml
- int GetNumInPeriod(XElement element, string creater, string assigned, string status)
3. Website模块
- 采用MSChart显示图
- 提示用户是否同步最新TT记录,否则读取上次同步时保存在本地的xml,降低对TT server的访问量
issue:
使用python编写脚本读取TestTrack,生成xml并导出(类似于手动选择某个project下的某些TT记录,通过File->Export功能导出,但貌似TT没有提供API接口,只好自己编写)
solution:
使用server.service.DatabaseLogon(dbname, user, password)登陆TT serever,使用GetRecordListForTable获取所有的record(Defect),通过获取的record[0]获取到defect number,调用server.service.getDefect来获取指定defect
Code
# create a connection to TT serverserver = suds.client.Client("http://10.7.88.11/ttsoapcgi.wsdl")# fetch all the projects you have access to.database_name = "TLBB"username = 'administrator'password = ""#logincookie = server.service.DatabaseLogon(database_name, username, password)try: #fetch all the defect rows = server.service.getRecordListForTable(cookie, "Defect") for record in rows.Records: # fectch specific defect using given defect number defect = server.service.getDefect(cookie, record[0].value, bDownloadAttachments=False) if defect.__dict__.hasKey("recordid"): recordid = defect.__dict__["recordid"] if defect.__dict__.hasKey("summary"): summary = defect.__dict__["summary"] # todo: get all the property of target defect instance except:finally: response = server.service.DatabaseLogoff(cookie)
- 使用Python读取TestTrack记录- Part1
- 使用Python读取TestTrack记录- Part2
- 使用Python读取TestTrack记录- Part3 动态生成Linq to xml查询语句筛选条件
- 使用Outlook插件实现自动保存邮件为TestTrack记录
- 使用Outlook插件实现自动保存邮件为TestTrack记录
- TestTrack Pro使用文档
- TestTrack Pro
- Python sourcecode analysis-part1
- python学习日记:part1
- python学习笔记 part1
- python常用模块part1
- 使用python读取excel
- 使用python读取excel
- Python pandas使用记录
- python unittest 使用记录
- python django 使用记录
- 学习使用fusionChart Part1
- python类与对象part1
- 框架子页面关闭所有窗口
- Activity详细讲解
- 程序员应该读的故事:三个事和三个问题
- 如何用UIKit做一个转轮
- 用ajax自己写仿 google search suggest的搜索提示
- 使用Python读取TestTrack记录- Part1
- fork函数的用法
- 仿百度搜索输入框提示JS代码(PHP+MySql数据库版)(基于jquery.autocomplete.js插件)
- 游戏外挂编程原理
- c语言初学-关于指针作为参数并改变它的值的问题
- linux 正则表达式
- 强类型的DataSet
- 模仿google suggest 下拉菜单
- ComBoBox添加到状态栏,添加的数据无法显示