01 xmind转成测试用例之XMind2TestCase使用指南导入禅道


1.安装Python

  网上教程很多,就不细写啦

2.安装xmind2testcase

  安装:pip install xmind2testcase

3.安装xmind

  进入到xmind的官网,下载最新的xmind8

4、XMind测试用例模板:

  在本地新增一个如下要求的xmind文件

 

 

 5、xmind测试用例模版需遵守的一些规则:

 6、导入禅道(ZenTao)

  1、编写完成xmind的用例后,需将XMind用例文件解析为禅道导入文件

    在命令行中进入xmind的存储路径,然后执行如下命令:
xmind2testcase XMind测试用例模板.xmind - csv ==> XMind测试用例模板.csv

  2、会在xmind存储路径下生成一个与xmind文件名一致的csv文件

  3、在禅道中导入csv即可,不需要切换编码格式

 

7、源码地址:

  GitHub 地址:https://github.com/zhuifengshen/xmind2testcase

 
 
在zentao.py中修改了满足开源版禅道导入用例模版的:
1、增加相关需求列,将summary字段用来存储需求id
2、修改优先级1、2、3源码对应的高中低、更改为1、2、3
3、将用例类型修改为:功能测试,接口测试
4、根据优先级定义适用阶段

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) fileheader = ["所属模块", "用例标题", "前置条件", "步骤", "预期", "关键词", "优先级", "用例类型", "适用阶段","相关需求"] zentao_testcase_rows = [fileheader] for testcase in testcases: row = gen_a_testcase_row(testcase) zentao_testcase_rows.append(row) def gen_a_testcase_row(testcase_dict): case_module = gen_case_module(testcase_dict['suite']) case_title = testcase_dict['name'] case_precontion = testcase_dict['preconditions'] case_step, case_expected_result = gen_case_step_and_expected_result(testcase_dict['steps']) case_keyword = '' case_priority = gen_case_priority(testcase_dict['importance']) case_type = gen_case_type(testcase_dict['execution_type']) case_apply_phase = gen_case_apply_phase(testcase_dict['importance']) case_prd = testcase_dict['summary'] row = [case_module, case_title, case_precontion, case_step, case_expected_result, case_keyword, case_priority, case_type, case_apply_phase,case_prd] return row def gen_case_priority(priority): mapping = {1: 1, 2: 2, 3: 3,4:4} if priority in mapping.keys(): return mapping[priority] else: return 2 def gen_case_apply_phase(priority): mapping = {1: "冒烟测试阶段", 2: "功能测试阶段", 3: "功能测试阶段",4:"功能测试阶段"} if priority in mapping.keys(): return mapping[priority] else: return 2 def gen_case_type(case_type): mapping = {1: '功能测试', 2: '接口测试'} if case_type in mapping.keys(): return mapping[case_type] else: return '功能测试'


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM