Modern style test report based on unittest framework.
Project description
Modern style test report based on unittest framework.
基于unittest框架现代风格测试报告。
特点
- 简洁、美观具有现代风格的测试报告。
- 支持
HTML/XML
不同格式。 - 支持
单元
、Web UI
、API
各种类型的测试。 - 集成
邮件/钉钉/企微/飞书
发送消息。 - 支持用例
错误/失败
重跑。 - 支持标签黑、白名单。
- 针对
Selenium
运行失败/错误自动截图(HTML格式)。 - 支持多语言
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
更多例子,请阅读 中文文档
感谢
感谢从以下项目中得到思路和帮助。
Project details
Release history Release notifications | RSS feed
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.7.6.tar.gz
(35.0 kB
view details)
Built Distribution
File details
Details for the file xtestrunner-1.7.6.tar.gz
.
File metadata
- Download URL: xtestrunner-1.7.6.tar.gz
- Upload date:
- Size: 35.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b1c9eb1a80826eb6247126c216d9bd3c96dda10065b833a7126c85c3efc906e |
|
MD5 | f6595699fb85ce724204c0627b45ecdd |
|
BLAKE2b-256 | 86d8e6118370185a8798f086e57fab3e584381eec7d7d287f511bc6836531ad3 |
File details
Details for the file xtestrunner-1.7.6-py3-none-any.whl
.
File metadata
- Download URL: xtestrunner-1.7.6-py3-none-any.whl
- Upload date:
- Size: 43.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f84d594f2e93adc4d08f71dfe473d78296c3c01f6ff44850471f460e7bc3e6a9 |
|
MD5 | 384ad703c66f7982fd915bf05e36241f |
|
BLAKE2b-256 | 160554230bf9d2119cec8d663a75ffc77184cbf9ccafa58214dba79372cb3961 |