服务器之家:专注于VPS、云服务器配置技术及软件下载分享
分类导航

PHP教程|ASP.NET教程|Java教程|ASP教程|编程技术|正则表达式|C/C++|IOS|C#|Swift|Android|VB|R语言|JavaScript|易语言|vb.net|

服务器之家 - 编程语言 - 编程技术 - Xmind用例导入到TAPD的解决方案

Xmind用例导入到TAPD的解决方案

2022-07-30 15:34测试超有范 编程技术

这篇文章主要介绍了Xmind用例导入到TAPD的方案,大家都知道XMind2TestCase ,该工具基于 Python 实现,通过制定测试用例通用模板,然后使用 XMind 这款广为流传且开源的思维导图工具进行用例设计,需要的朋友可以参考下

概述

本方案使用的是,参考开源项目XMind2TestCase的实现逻辑,按照TAPD导入的格式,把XMind2TestCase项目的表头以及数据做一定修改,使生成的数据符合tapd的导入要求。

XMind2TestCase项目介绍

XMind2TestCase ,该工具基于 Python 实现,通过制定测试用例通用模板
然后使用 XMind 这款广为流传且开源的思维导图工具进行用例设计。
其中制定测试用例通用模板是一个非常核心的步骤(具体请看(附件包里面doc/readme)),有了通用的测试用例模板,我们就可以在 XMind 文件上解析并提取出测试用例所需的基本信息,
然后合成常见测试用例管理系统所需的用例导入文件。这样就将 XMind 设计测试用例的便利常见测试用例系统的高效管理结合起来了!
当前 XMind2TestCase 已实现从 XMind 文件到 TestLink 和 Zentao(禅道) 两大常见用例管理系统的测试用例转换,同时也提供 XMind 文件解析后的两种数据接口
(TestSuites、TestCases两种级别的JSON数据),方便快速与其他测试用例管理系统打通。

项目地址:XMind2TestCase
项目介绍及使用(网盘包里面):xmind2testcase-master\README.md(这个必看,不然不知知道怎么实现喔!!!)

百度网盘链接

链接: https://pan.baidu.com/s/1VDTyBd5_QDPc7kfgjuvWHw?pwd=e15m 提取码: e15m 

具体修改点

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#修改表头
def xmind_to_zentao_csv_file(xmind_file):
    """Convert XMind file to a zentao csv file"""
    xmind_file = get_absolute_path(xmind_file)  #路径处理
    logging.info('Start converting XMind file(%s) to zentao file...', xmind_file)
    testcases = get_xmind_testcase_list(xmind_file) #解析xmind文档,得到原始数据
    # print("testcases",testcases)
    #fileheader =      ["所属模块","用例标题","前置条件","步骤", "预期", "关键词>用例状态", "优先级", "用例类型", "适用阶段?"]
    fileheader_tapd = ["用例目录","用例名称","需求ID","前置条件","用例步骤","预期结果","用例类型","用例状态","用例等级","创建人","测试结果","备注说明"]
 
    zentao_testcase_rows = [fileheader_tapd]
    for testcase in testcases:
        #row = gen_a_testcase_row(testcase)
        row = gen_a_testcase_row_tapd(testcase)
        zentao_testcase_rows.append(row)
    zentao_file = xmind_file[:-6] + '.csv'
    if os.path.exists(zentao_file):  #判断括号里的文件是否存在
        os.remove(zentao_file)
        # logging.info('The zentao csv file already exists, return it directly: %s', zentao_file)
        # return zentao_file
 
    with open(zentao_file, 'w', encoding='utf8') as f:
        writer = csv.writer(f)
        writer.writerows(zentao_testcase_rows)
        logging.info('Convert XMind file(%s) to a zentao csv file(%s) successfully!', xmind_file, zentao_file)
 
    return zentao_file
    
#修改为tapd的数据格式、增加获取需求ID
def gen_a_testcase_row_tapd(testcase_dict):
 
    #用例标题
    case_title = testcase_dict['name']
    #需求ID         产品名称里的目录获取 
    requirement_id, product_catalog = gen_requirement_id(testcase_dict['product'])
    # 所属模块
    case_module =product_catalog +"-" + gen_case_module(testcase_dict['suite'])
 
    #前置条件
    case_precontion = testcase_dict['preconditions']
    #步骤       预期结果
    case_step, case_expected_result = gen_case_step_and_expected_result(testcase_dict['steps'])
    #用例类型
    case_type = gen_case_type(testcase_dict['execution_type'])
    # case_type = "功能测试"
    #用例状态
    case_status = "正常"
    #用例等级
    case_priority = gen_case_priority(testcase_dict['importance'])
    #创建人
    case_created_by = ""
    #测试结果
    case_actual_result= ""
 
    row = [case_module,case_title,requirement_id,case_precontion,case_step,case_expected_result,case_type,case_status,case_priority,case_created_by,case_actual_result]
    return row
 
#修改用例类型
def get_execution_type(topics):
    labels = [topic.get('label', '') for topic in topics]
    labels = filter_empty_or_ignore_element(labels)
    exe_type = 1
    for item in labels[::-1]:
        if item.lower() in ['性能测试', '性能']:
            exe_type = 2
            break
        if item.lower() in ['功能测试', '功能']:
            exe_type = 1
            break
        if item.lower() in ['安全测试', '安全','安全性测试']:
            exe_type = 3
            break
        if item.lower() in ['其他']:
            exe_type = 4
            break
    return exe_type

使用方法

1、安装库:pip3 install xmind2testcase
2、xmind模板及说明(格式要求里面描述很清晰了):xmind2testcase-master\docs\zentao_testcase_template.xmind
3、运行方式:①运行zentao.py ②使用webtool工具(可放再服务器上多人使用)

Xmind用例导入到TAPD的解决方案

Xmind用例导入到TAPD的解决方案

 其他:

使用案例,好久之前写的,基本能用,最终没有在项目推行,这里共享给大家。

链接: https://pan.baidu.com/s/1VDTyBd5_QDPc7kfgjuvWHw?pwd=e15m 提取码: e15m 

特别说明:
1、标签的测试方式已改成:功能测试、性能测试、安全测试、其他
2、根名称做了适用tapd的处理,如下图结构:【ID1016373】SIT-V2.6.3 - 2021春节活动二-
【ID1016373】是需求ID,要需求ID则必须要带【】,且放在前面,没有需求ID则不写这个【】,则结果为空
SIT-V2.6.3 - 2021春节活动二:是在TAPD的目录路径

Xmind用例导入到TAPD的解决方案

到此这篇关于Xmind用例导入到TAPD的方案的文章就介绍到这了,更多相关Xmind导入到TAPD内容请搜索服务器之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持服务器之家!

原文链接:https://blog.csdn.net/u011072936/article/details/125951162

延伸 · 阅读

精彩推荐