这几天搞了一个XMind转换案例的py脚本,可以一键将XMind测试大纲转为测试案例,有测试场景,测试步骤,预期结果。节省了很多时间。今天分享给大家,用得着的人可以节约很多很多时间。
上图
需要的小伙伴可以试试
部分代码
# 写入场景
row = 1
for path in scenarios:
sheet.write(row, 0, path, style)
row += 1
# 写入步骤
row = 1
for path in steps:
path_parts = path.split('-')
modified_path = "\n".join(path_parts[:-1]) # 将 '-' 替换为换行符
sheet.write(row, 1, modified_path, style)
row += 1
# 写入预期结果
row = 1
for last_node in last_nodes:
sheet.write(row, 2, last_node["title"], style)
row += 1
workbook.save(excel_path)
def choose_xmind_file():
file_path = filedialog.askopenfilename(filetypes=[("XMind Files", "*.xmind")])
if file_path:
xmind_path.set(file_path)