subunit 协议
subunit是一个协议, 用来对不同语言(C, Python, Shell)的测试输出结果进行标准序列化
subunit协议的数据结构
- 数据包结构
PACKET := SIGNATURE FLAGSPACKET_LENGTH TIMESTAMP? TESTID? TAGS? MIME?FILECONTENT? ROUTING_CODE? CRC32
- 一个数据包例子
Trivial test "foo"enumeration packet, with test id, runnable set,status=enumeration. Spaces beloware to visually break up signature / flags / length / testid / crc32
subunit Integrationwith Python
用python生成subunit原始数据
使用subunit执行某个test case, 并输出原始 subunit 数据包
$ python-m subunit.run thinking.tests.core.test_string_service
�)@P@Ethinking.tests.core.test_string_service.StringTestCase.test_partition���T�)@Q@Fthinking.tests.core.test_string_service.StringTestCase.test_rpartition�'爳+[1]@XS�P���n�@Ethinking.tests.core.test_string_service.StringTestCase.test_partition�����+
@XS�P���Cp@Ethinking.tests.core.test_string_service.StringTestCase.test_partition�rm�+[1]@YS�P���@Fthinking.tests.core.test_string_service.StringTestCase.test_rpartition9��F�+
@YS�P���d8@Fthinking.tests.core.test_string_service.StringTestCase.test_rpartition���
使用subunit发现指定目录下的所有test case, 并输出原始 subunit 数据包
$ python-m subunit.run discover./thinking/tests
�)6-core.test_data_type.ArrayTestCase.test_append�e)90core.test_data_type.ArrayTestCase.test_enumerate�‑��)6-core.test_data_type.ArrayTestCase.test_extend1Q�)5,core.test_data_type.ArrayTestCase.test_indexK��v�);2core.test_data_type.CollectionsTestCase.test_dequecj�߳)90core.test_data_type.DictTestCase.test_setdefaultz�Wp�)@C9core.test_generator.GeneratorTestCase.test_count_with_for��鯳)@D:core.test_generator.GeneratorTestCase.test_count_with_nextS%���)?6core.test_generator.GeneratorTestCase.test_iter_object���ٳ)90core.test_generator.GeneratorTestCase.test_yield�
���);2core.test_io_access.PathNameTestCase.test_basename�߭³)@A7core.test_metaclass.MetaClassTestCase.test_new_instance�G�g�)?6core.test_string_service.StringTestCase.test_partition���4�)@A7core.test_string_service.StringTestCase.test_rpartitionL6K�+[1]>S�R��
@�-core.test_data_type.ArrayTestCase.test_append8�bC�+
>S�R�-core.test_data_type.ArrayTestCase.test_append��K��+[1]@BS�R��,(0core.test_data_type.ArrayTestCase.test_enumerate���J�+
@BS�R��lx0core.test_data_type.ArrayTestCase.test_enumerateLfi�+[1]>S�R����-core.test_data_type.ArrayTestCase.test_extendX���+
>S�R��@-core.test_data_type.ArrayTestCase.test_extendrσ�+[1]=S�R��w�,core.test_data_type.ArrayTestCase.test_index�U߳+
=S�R���h,core.test_data_type.ArrayTestCase.test_index��;�+[1]@DS�R����2core.test_data_type.CollectionsTestCase.test_deque���ɳ+
@DS�R����2core.test_data_type.CollectionsTestCase.test_deque�~�[�+[1]@BS�R��W�0core.test_data_type.DictTestCase.test_setdefaultr�T��+
@BS�R����0core.test_data_type.DictTestCase.test_setdefault�| �+[1]@KS�R����9core.test_generator.GeneratorTestCase.test_count_with_for��x�+
@KS�R��$�`9core.test_generator.GeneratorTestCase.test_count_with_for�Q?�+[1]@LS�R��%��:core.test_generator.GeneratorTestCase.test_count_with_nextE�+
@LS�R��'!@:core.test_generator.GeneratorTestCase.test_count_with_next\����+[1]@HS�R��(|�6core.test_generator.GeneratorTestCase.test_iter_objectKJ�ȳ+
@HS�R��)��6core.test_generator.GeneratorTestCase.test_iter_object�w���+[1]@BS�R��*��0core.test_generator.GeneratorTestCase.test_yieldM�a�+
@BS�R��,20core.test_generator.GeneratorTestCase.test_yield �pO�+[1]@DS�R��.2core.test_io_access.PathNameTestCase.test_basename�|
��+
@DS�R��0p2core.test_io_access.PathNameTestCase.test_basenamei�z��+[1]@IS�R��1��7core.test_metaclass.MetaClassTestCase.test_new_instanceS�#�+
@IS�R��3�7core.test_metaclass.MetaClassTestCase.test_new_instance�
̳+[1]@HS�R��46core.test_string_service.StringTestCase.test_partition�7�Z�+
@HS�R��5��6core.test_string_service.StringTestCase.test_partition�A�7�+[1]@IS�R��7H7core.test_string_service.StringTestCase.test_rpartition��;5�+
@IS�R��84X7core.test_string_service.StringTestCase.test_rpartition��2
如何转换 subunit 原始数据
转换subunit数据为junit xml格式
$ python-m subunit.run thinking.tests.core.test_string_service | subunit2junitxml
<testsuiteerrors="0" failures="0" name=""tests="2" time="0.003">
<testcaseclassname="thinking.tests.core.test_string_service.StringTestCase"name="test_partition" time="0.000"/>
<testcaseclassname="thinking.tests.core.test_string_service.StringTestCase"name="test_rpartition" time="0.000"/>
</testsuite>
转换subunit数据为统计报告格式
$ python-m subunit.run thinking.tests.core.test_string_service | subunit-stats
Total tests: 2
Passed tests: 2
Failed tests: 0
Skipped tests: 0
Seen tags:
其他可以使用的转换工具
* tap2subunit -convert perl's TestAnythingProtocol to subunit.
* subunit2csv -convert a subunit stream to csv.
* subunit2pyunit -convert a subunit stream to pyunit test results.
* subunit2gtk - showa subunit stream in GTK.
* subunit2junitxml -convert a subunit stream to JUnit's XML format.
* subunit-diff -compare two subunit streams.
* subunit-filter -filter out tests from a subunit stream.
* subunit-ls - listinfo about tests present in a subunit stream.
* subunit-stats -generate a summary of a subunit stream.
* subunit-tags - addor remove tags from a stream.
subunit 协议相关推荐
- 温故OpenStack中的测试(by Joshua)
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明 (作者:张华 发表于:2018-03-15) 沿用tox调用virtualenv自动创建的虚拟环境(virtua ...
- 通过demo学习OpenStack开发所需的基础知识 -- 单元测试
本文将进入单元测试的部分,这也是基础知识中最后一个大块.本文将重点讲述Python和OpenStack中的单元测试的生态环境. 单元测试的重要性 github上有个人画了一些不同语言的学习曲线图:Le ...
- 通过demo学习OpenStack开发——单元测试
本文将进入单元测试的部分,这也是基础知识中最后一个大块.本文将重点讲述Python和OpenStack中的单元测试的生态环境. 通过demo学习OpenStack开发--单元测试\ 单元测试的重要性\ ...
- 【经典蓝牙】蓝牙AVRCP协议分析
协议简介 蓝牙AVRCP协议是蓝牙设备之间音视频的控制协议.定义了音频/视频的控制.浏览.查询.通知等一系列的命令集.常用来蓝牙耳机对手机的音乐进行控制,以及获取手机的音乐信息等场景.AVRCP协议有 ...
- 常用开源协议介绍以及开源软件规范列表
1. 开源协议介绍 GPL: General Public License,开源项目最常用的许可证,衍生代码的分发需开源并且也要遵守此协议.该协议也有很多变种,不同变种要求会略微不同. MPL: MP ...
- Redis 笔记(11)— 文本协议 RESP(单行、多行字符串、整数、错误、数组、空值、空串格式、telnet 登录 redis)
RESP 是 Redis 序列化协议Redis Serialization Protocol 的简写.它是一种直观的文本协议,优势在于实现异常简单,解析性能极好. Redis 协议将传输的结构数据 ...
- HTTP 协议入门 — (TCP/IP协议族、通信传输流、URI 与 URL 的区别、Cookie 状态管理、HTTP 支持的方法、状态码类别、HTTP 首部字段)
TCP/IP协议族 在介绍 HTTP 协议之前,我们先对 TCP/IP 协议族有个大概的了解,TCP/IP 协议从上到下主要分为应用层.传输层.网络层和数据链路层,各层的主要功能如下表所示: 协议层 ...
- 【JavaWeb】servlet与http请求协议
Servlet: 概念: server applet (服务端小程序)运行在服务器端的小程序 Servlet就是一个接口,定义了Java类被浏览器访问到(Tomcat识别)的规则. 将我我们自定义一个 ...
- synopsys PCIE IP协议解析
synopsys PCIE IP协议解析 1.Overview Core支持单个Pcie内核的Loopback功能,该功能主要为了做芯片验证,以及在没有远程接收器件的情况下完成自己的回环.同时,Cor ...
最新文章
- JAVA时间日期处理类,主要用来遍历两个日期之间的每一天。
- 欢迎使用CSDN-markdown
- 2345联盟通过流氓软件推广挖矿工具, 众多用户电脑沦为“肉鸡”
- 深度学习之卷积、全连接、反卷积等
- oracle的成本核算,请教一下ORACLE ERP制造成本核算(标准成本法)的优点,多谢了!...
- 为什么重复率高的字段不适合作为索引
- 【C语言学习教程---1】VC++6.0的安装和创建简单C语言工程文件教程
- VMware tools 安装失败
- 51nod 巧克力 1429
- ssm 项目中引用 百度bae的sdk 安装jar
- 纳德拉:Windows Phone市场份额虽低 但它“完整了体验”
- 团队开发如何评估工作量
- Python 操作pdf文件-加密与解密 (二)
- JAVA 启动JVM时,Xms和Xmx参数
- php 支付宝用户信息授权,支付宝 app应用 授权 php + APICloud
- 【NB-ioT模组】移远BC35-G 基于STM32连接电信云(附代码)
- Tether操纵市场了吗?
- OD笔试题-空汽水瓶可以换汽水
- Linux常用命令——sysctl命令
- 护网HVV(蓝队)小白必知必会