Modern style test report based on unittest framework.
基于unittest框架现代风格测试报告。
特点
- 简洁、美观具有现代风格的测试报告。
- 支持
HTML、XML两种格式。 - 支持
单元、Web UI、API各种类型的测试。 - 集成
邮件/钉钉/企微/飞书发送消息。 - 支持用例
错误/失败重跑。 - 支持标签黑、白名单。
- 针对
Selenium运行失败/错误自动截图。 - 支持多语言:
en、zh-CN(注:仅HTML格式)。
Report
Install
> pip install XTestRunner
If you want to keep up with the latest version, you can install with github repository url:
> pip install -U git+https://github.com/SeldomQA/XTestRunner.git@master
demo
查看更多使用 例子。
- unittest测试
import unittest
from XTestRunner import HTMLTestRunner
class TestDemo(unittest.TestCase):
"""测试用例说明"""
def test_success(self):
"""执行成功"""
self.assertEqual(2 + 3, 5)
@unittest.skip("skip case")
def test_skip(self):
"""跳过用例"""
pass
def test_fail(self):
"""失败用例"""
self.assertEqual(5, 6)
def test_error(self):
"""错误用例"""
self.assertEqual(a, 6)
if __name__ == '__main__':
suit = unittest.TestSuite()
suit.addTests([
TestDemo("test_success"),
TestDemo("test_skip"),
TestDemo("test_fail"),
TestDemo("test_error")
])
with(open('./result.html', 'wb')) as fp:
runner = HTMLTestRunner(
stream=fp,
title='<project name>test report',
description='describe: ... ',
language='en',
rerun=3
)
runner.run(suit)
Document
更多例子,请阅读 中文文档
其他
感谢
感谢从以下项目中得到思路和帮助。
静态文件服务
1.添加静态文件到github项目。
https://github.com/defnngj/Telegraph-Image
2.cloudflare提供免费的访问域名。
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
xtestrunner-1.8.6.tar.gz
(1.1 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xtestrunner-1.8.6.tar.gz.
File metadata
- Download URL: xtestrunner-1.8.6.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d4a67a422a1dc4c48430db37b44255e5cf49fd2707c91521d35692eb29b94c4
|
|
| MD5 |
0586e05654d27c422397823606c7eff0
|
|
| BLAKE2b-256 |
c8e99c456a5988d22a7d250e7ea0c415305879b84574306dca9848340a64655b
|
File details
Details for the file xtestrunner-1.8.6-py3-none-any.whl.
File metadata
- Download URL: xtestrunner-1.8.6-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
19f74290f0e2456da7ed21faabf1164fbf6bc6746c252b595a46740680cf64a2
|
|
| MD5 |
0e1349d6df2deb5636c1f7673c119c77
|
|
| BLAKE2b-256 |
39e01639c5d3afb9d543175bf12aba211862ff462d2812a0590b6022210d3e83
|