日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學(xué)無(wú)先后,達(dá)者為師

網(wǎng)站首頁(yè) 編程語(yǔ)言 正文

Xmind用例導(dǎo)入到TAPD的解決方案_其它綜合

作者:測(cè)試超有范 ? 更新時(shí)間: 2022-09-20 編程語(yǔ)言

概述

本方案使用的是,參考開(kāi)源項(xiàng)目XMind2TestCase的實(shí)現(xiàn)邏輯,按照TAPD導(dǎo)入的格式,把XMind2TestCase項(xiàng)目的表頭以及數(shù)據(jù)做一定修改,使生成的數(shù)據(jù)符合tapd的導(dǎo)入要求。

XMind2TestCase項(xiàng)目介紹

XMind2TestCase?,該工具基于 Python 實(shí)現(xiàn),通過(guò)制定測(cè)試用例通用模板
然后使用?XMind?這款廣為流傳且開(kāi)源的思維導(dǎo)圖工具進(jìn)行用例設(shè)計(jì)。
其中制定測(cè)試用例通用模板是一個(gè)非常核心的步驟(具體請(qǐng)看(附件包里面doc/readme)),有了通用的測(cè)試用例模板,我們就可以在 XMind 文件上解析并提取出測(cè)試用例所需的基本信息,
然后合成常見(jiàn)測(cè)試用例管理系統(tǒng)所需的用例導(dǎo)入文件。這樣就將?XMind 設(shè)計(jì)測(cè)試用例的便利常見(jiàn)測(cè)試用例系統(tǒng)的高效管理結(jié)合起來(lái)了!
當(dāng)前?XMind2TestCase?已實(shí)現(xiàn)從 XMind 文件到 TestLink 和 Zentao(禪道) 兩大常見(jiàn)用例管理系統(tǒng)的測(cè)試用例轉(zhuǎn)換,同時(shí)也提供 XMind 文件解析后的兩種數(shù)據(jù)接口
(TestSuites、TestCases兩種級(jí)別的JSON數(shù)據(jù)),方便快速與其他測(cè)試用例管理系統(tǒng)打通。

項(xiàng)目地址:XMind2TestCase
項(xiàng)目介紹及使用(網(wǎng)盤(pán)包里面):xmind2testcase-master\README.md(這個(gè)必看,不然不知知道怎么實(shí)現(xiàn)喔!!!)

百度網(wǎng)盤(pán)鏈接

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

具體修改點(diǎn)

#修改表頭
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文檔,得到原始數(shù)據(jù)
    # print("testcases",testcases)
    #fileheader =      ["所屬模塊","用例標(biāo)題","前置條件","步驟", "預(yù)期", "關(guān)鍵詞>用例狀態(tài)", "優(yōu)先級(jí)", "用例類型", "適用階段?"]
    fileheader_tapd = ["用例目錄","用例名稱","需求ID","前置條件","用例步驟","預(yù)期結(jié)果","用例類型","用例狀態(tài)","用例等級(jí)","創(chuàng)建人","測(cè)試結(jié)果","備注說(shuō)明"]
 
    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):  #判斷括號(hào)里的文件是否存在
        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的數(shù)據(jù)格式、增加獲取需求ID
def gen_a_testcase_row_tapd(testcase_dict):
 
    #用例標(biāo)題
    case_title = testcase_dict['name']
    #需求ID         產(chǎn)品名稱里的目錄獲取  
    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']
    #步驟       預(yù)期結(jié)果
    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 = "功能測(cè)試"
    #用例狀態(tài)
    case_status = "正常"
    #用例等級(jí)
    case_priority = gen_case_priority(testcase_dict['importance'])
    #創(chuàng)建人
    case_created_by = ""
    #測(cè)試結(jié)果
    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 ['性能測(cè)試', '性能']:
            exe_type = 2
            break
        if item.lower() in ['功能測(cè)試', '功能']:
            exe_type = 1
            break
        if item.lower() in ['安全測(cè)試', '安全','安全性測(cè)試']:
            exe_type = 3
            break
        if item.lower() in ['其他']:
            exe_type = 4
            break
    return exe_type

使用方法

1、安裝庫(kù):pip3 install xmind2testcase
2、xmind模板及說(shuō)明(格式要求里面描述很清晰了):xmind2testcase-master\docs\zentao_testcase_template.xmind
3、運(yùn)行方式:①運(yùn)行zentao.py ②使用webtool工具(可放再服務(wù)器上多人使用)

?其他:

使用案例,好久之前寫(xiě)的,基本能用,最終沒(méi)有在項(xiàng)目推行,這里共享給大家。

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

特別說(shuō)明:
1、標(biāo)簽的測(cè)試方式已改成:功能測(cè)試、性能測(cè)試、安全測(cè)試、其他
2、根名稱做了適用tapd的處理,如下圖結(jié)構(gòu):【ID1016373】SIT-V2.6.3 - 2021春節(jié)活動(dòng)二-
【ID1016373】是需求ID,要需求ID則必須要帶【】,且放在前面,沒(méi)有需求ID則不寫(xiě)這個(gè)【】,則結(jié)果為空
SIT-V2.6.3 - 2021春節(jié)活動(dòng)二:是在TAPD的目錄路徑

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

欄目分類
最近更新