1、背景java
软件测试过程当中,最重要、最核心就是测试用例的设计,也是测试童鞋、测试团队平常投入最多时间的工做内容之一。python
然而,传统的测试用例设计过程有不少痛点:git
基于这些状况,如今愈来愈多公司选择使用思惟导图这种高效的生产力工具进行用例设计,特别是敏捷开发团队。github
事实上也证实,思惟导图其发散性思惟、图形化思惟的特色,跟测试用例设计时所需的思惟很是吻合,因此在实际工做中极大提高了咱们测试用例设计的效率,也很是方便测试用例评审。web
可是与此同时,使用思惟导图进行测试用例设计的过程当中也带来很多问题:json
综合以上状况,咱们能够发现不一样的测试用例设计方式,各有各个的优劣。markdown
那么问题来了,咱们能不能将它们各自优势合在一块儿呢?这样不就能够提高咱们的效率了!ide
因而,这时候 XMind2TestCase 就应运而生了,该工具基于 Python 实现,经过制定测试用例通用模板,
而后使用 XMind 这款广为流传且开源的思惟导图工具进行用例设计。
其中制定测试用例通用模板是一个很是核心的步骤(具体请看使用指南),有了通用的测试用例模板,咱们就能够在 XMind 文件上解析并提取出测试用例所需的基本信息,
而后合成常见测试用例管理系统所需的用例导入文件。这样就将 XMind 设计测试用例的便利与常见测试用例系统的高效管理结合起来了!工具
当前 XMind2TestCase 已实现从 XMind 文件到 TestLink 和 Zentao(禅道) 两大常见用例管理系统的测试用例转换,同时也提供 XMind 文件解析后的两种数据接口
(TestSuites、TestCases两种级别的JSON数据),方便快速与其余测试用例管理系统打通。测试
pip3 install xmind2testcase
pip3 install -U xmind2testcase
Usage:
xmind2testcase [path_to_xmind_file] [-csv] [-xml] [-json]
Example:
xmind2testcase /path/to/testcase.xmind => output testcase.csv、testcase.xml、testcase.json
xmind2testcase /path/to/testcase.xmind -csv => output testcase.csv
xmind2testcase /path/to/testcase.xmind -xml => output testcase.xml
xmind2testcase /path/to/testcase.xmind -json => output testcase.json
Usage:
xmind2testcase [webtool] [port_num]
Example:
xmind2testcase webtool => launch the web testcase convertion tool locally -> 127.0.0.1:5001
xmind2testcase webtool 8000 => launch the web testcase convertion tool locally -> 127.0.0.1:8000
import json
import xmind
from xmind2testcase.zentao import xmind_to_zentao_csv_file
from xmind2testcase.testlink import xmind_to_testlink_xml_file
from xmind2testcase.utils import xmind_testcase_to_json_file
from xmind2testcase.utils import xmind_testsuite_to_json_file
from xmind2testcase.utils import get_xmind_testcase_list
from xmind2testcase.utils import get_xmind_testsuite_list
def main():
xmind_file = 'docs/xmind_testcase_template.xmind'
print('Start to convert XMind file: %s' % xmind_file)
zentao_csv_file = xmind_to_zentao_csv_file(xmind_file)
print('Convert XMind file to zentao csv file successfully: %s' % zentao_csv_file)
testlink_xml_file = xmind_to_testlink_xml_file(xmind_file)
print('Convert XMind file to testlink xml file successfully: %s' % testlink_xml_file)
testsuite_json_file = xmind_testsuite_to_json_file(xmind_file)
print('Convert XMind file to testsuite json file successfully: %s' % testsuite_json_file)
testcase_json_file = xmind_testcase_to_json_file(xmind_file)
print('Convert XMind file to testcase json file successfully: %s' % testcase_json_file)
testsuites = get_xmind_testsuite_list(xmind_file)
print('Convert XMind to testsuits dict data:\n%s' % json.dumps(testsuites, indent=2, separators=(',', ': '), ensure_ascii=False))
testcases = get_xmind_testcase_list(xmind_file)
print('Convert Xmind to testcases dict data:\n%s' % json.dumps(testcases, indent=4, separators=(',', ': ')))
workbook = xmind.load(xmind_file)