提效工具

编程入门 行业动态 更新时间:2024-10-07 12:17:43

提效<a href=https://www.elefans.com/category/jswz/34/1770073.html style=工具"/>

提效工具

前言

每个公司都有一个维护测试case的系统,有自研的也有买的,比如QC, 禅道等等,QA往往习惯使用xmind等思维导图工具来编写测试用例。

因为思路清晰,编写方便,那么这就有一个问题,大多数公司要求所有的case都要导入到系统统一维护,然而系统对xmind的支持并不友好,或者根本不支持,就我们目前的情况来说,系统支持导入xmind文件导入,但是导入后所有的用例都是乱的,而且没有测试步骤,没有预期结果等等问题,因此针对这一痛点,便诞生了今天的小工具,虽然这个工具只能解决我的问题,但是里面有大家可以学习参考的地方,希望对你有帮助,那么我的目的就达到了。

一、工具源码

  """import tkinter as tkfrom tkinter import filedialog, messageboximport xmindimport osfrom xmindparser import xmind_to_dictclass ParseXmind(object):def __init__(self, root):self.count = 0self.case_fail = 0self.case_success = 0self.case_block = 0self.case_priority = 0# total汇总用self.total_cases = 0self.total_success = 0self.total_fail = 0self.total_block = 0self.toal_case_priority = 0# GUIroot.title('Xmind用例个数统计及文件解析')width = 760height = 600xscreen = root.winfo_screenwidth()yscreen = root.winfo_screenheight()xmiddle = (xscreen - width) / 2ymiddle = (yscreen - height) / 2root.geometry('%dx%d+%d+%d' % (width, height, xmiddle, ymiddle))  # 窗口默认大小# 3个frameself.frm1 = tk.Frame(root)self.frm2 = tk.Frame(root)self.frm3 = tk.Frame(root)#  布局self.frm1.grid(row = 1, padx = '20', pady = '20')self.frm2.grid(row = 2, padx = '30', pady = '30')self.frm3.grid(row = 0, padx = '40', pady = '40')self.lable = tk.Label(self.frm3, text = "Xmind文件完整路径")self.lable.grid(row = 0, column = 0, pady = '5')self.file_path = tk.Entry(self.frm3, bd = 2)self.file_path.grid(row = 0, column = 1, pady = '5')def get_full_file_path_text():"""获取xmind文件完整路径:return:"""full_xmind_path = self.file_path.get()  # 获取文本框内容#  简单对输入内容做一个校验if full_xmind_path == "" or "xmind" not in full_xmind_path:messagebox.showinfo(title = "warning", message = "xmind文件路径错误!")try:self.create_new_xmind(full_xmind_path)except FileNotFoundError:passelse:xmind_file = full_xmind_path[:-6].split("/")[-1]  # xmind文件名,不带后缀path_list = full_xmind_path[:-6].split("/")  # xmind文件用/分割后的一个列表path_list.pop(0)path_list.pop(-1)path_full = "/" + "/".join(path_list)  # xmind文件的目录new_xmind_file = "{}/{}_new.xmind".format(path_full, xmind_file)  # 新的xmind文件完整路径messagebox.showinfo(title = "success", message = "已生成新的xmind文件:{}".format(new_xmind_file))#  页面的一些空间的布局self.button = tk.Button(self.frm3, text =

更多推荐

提效工具

本文发布于:2024-02-14 03:53:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1761812.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工具

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!