close
Skip to content

Allenzzz/x2case

Repository files navigation

X2Case

X2Case , Xmind 文件转 jira CSV 文件。 支持新版 xmind zen。

一、安装 Install

pip3 install x2case

二、使用方式 Usage

1. to jira csv

import json
import logging

from x2case.func import XmindZenParser
from x2case.jira import xmind_to_jira_csv_file

logging.basicConfig(level=logging.INFO)

xmind_file = 'docs/jira_demo.xmind'
print('Start to convert XMind file: %s' % xmind_file)

# 1、testcases import file
# (1) jira
csv_file = xmind_to_jira_csv_file(xmind_file)
print(f'Convert XMind file to zentao csv file successfully: {xmind_file}')

2. to testcases json file

parser = XmindZenParser(xmind_file)
# (1) testsuite
testsuite_json_file = parser.xmind_2_suite_json_file()
print('Convert XMind file to testsuite json file successfully: %s' % testsuite_json_file)
# (2) testcase
testcase_json_file = parser.xmind_2_case_json_file()
print('Convert XMind file to testcase json file successfully: %s' % testcase_json_file)

3、test dict/json data

# (1) testsuite

test_suite = parser.get_xmind_testsuite_list()
print('Convert XMind to test suits dict data:\n%s' %
      json.dumps(test_suite, indent=2, separators=(',', ': '), ensure_ascii=False))
# (2) testcase
testcases = parser.get_xmind_testcase_list()
print('Convert Xmind to testcases dict data:\n%s' %
      json.dumps(testcases, indent=4, separators=(',', ': '), ensure_ascii=False))

print('Finished conversion, Congratulations!')

4. 直接XMind文件转换为CSV (Direct XMind to CSV conversion)

from x2case.convert import CustomCsvConverter

# 创建转换器实例
converter = CustomCsvConverter()

# 直接转换XMind文件(会自动保存为CSV文件)
xmind_file = 'docs/jira_demo.xmind'
result = converter.convert2file(xmind_file)

# 检查转换结果
if result.is_success() or result.is_partial_success():
    print("转换成功!")
    print(f"CSV数据行数: {len(result.csv_data)}")
    print(f"CSV文件已自动保存到: {result.csv_file}")
else:
    print(f"转换失败: {result.err_messages}")

About

Xmind zen

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages