網(wǎng)站首頁(yè) 編程語(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
相關(guān)推薦
- 2022-04-21 C++實(shí)現(xiàn)MyString的示例代碼_C 語(yǔ)言
- 2022-06-29 tomcat正常啟動(dòng)但網(wǎng)頁(yè)卻無(wú)法訪問(wèn)的幾種解決方法_Tomcat
- 2022-09-16 JQuery實(shí)現(xiàn)電梯導(dǎo)航效果_jquery
- 2022-08-23 Python解析器Cpython的GIL解釋器鎖工作機(jī)制_python
- 2022-07-03 pandas選擇或添加列生成新的DataFrame操作示例_python
- 2023-07-22 linux查看進(jìn)程的啟動(dòng)路徑:ll /proc/PID
- 2022-01-31 微信小程序獲取二維碼中URL中帶的參數(shù)
- 2022-09-29 React事件監(jiān)聽(tīng)和State狀態(tài)修改方式_React
- 最近更新
-
- window11 系統(tǒng)安裝 yarn
- 超詳細(xì)win安裝深度學(xué)習(xí)環(huán)境2025年最新版(
- Linux 中運(yùn)行的top命令 怎么退出?
- MySQL 中decimal 的用法? 存儲(chǔ)小
- get 、set 、toString 方法的使
- @Resource和 @Autowired注解
- Java基礎(chǔ)操作-- 運(yùn)算符,流程控制 Flo
- 1. Int 和Integer 的區(qū)別,Jav
- spring @retryable不生效的一種
- Spring Security之認(rèn)證信息的處理
- Spring Security之認(rèn)證過(guò)濾器
- Spring Security概述快速入門(mén)
- Spring Security之配置體系
- 【SpringBoot】SpringCache
- Spring Security之基于方法配置權(quán)
- redisson分布式鎖中waittime的設(shè)
- maven:解決release錯(cuò)誤:Artif
- restTemplate使用總結(jié)
- Spring Security之安全異常處理
- MybatisPlus優(yōu)雅實(shí)現(xiàn)加密?
- Spring ioc容器與Bean的生命周期。
- 【探索SpringCloud】服務(wù)發(fā)現(xiàn)-Nac
- Spring Security之基于HttpR
- Redis 底層數(shù)據(jù)結(jié)構(gòu)-簡(jiǎn)單動(dòng)態(tài)字符串(SD
- arthas操作spring被代理目標(biāo)對(duì)象命令
- Spring中的單例模式應(yīng)用詳解
- 聊聊消息隊(duì)列,發(fā)送消息的4種方式
- bootspring第三方資源配置管理
- GIT同步修改后的遠(yuǎn)程分支