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