https://github.com/seldomqa/xtestrunner
Modern style test report based on unittest framework.
https://github.com/seldomqa/xtestrunner
html python unittest
Last synced: about 2 months ago
JSON representation
Modern style test report based on unittest framework.
- Host: GitHub
- URL: https://github.com/seldomqa/xtestrunner
- Owner: SeldomQA
- License: apache-2.0
- Created: 2016-05-05T13:31:32.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2025-01-17T16:52:58.000Z (6 months ago)
- Last Synced: 2025-05-15T12:06:17.597Z (about 2 months ago)
- Topics: html, python, unittest
- Language: Python
- Homepage:
- Size: 13.7 MB
- Stars: 177
- Watchers: 9
- Forks: 130
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
README

> Modern style test report based on unittest framework.
基于unittest框架现代风格测试报告。
### 特点
* 简洁、美观具有现代风格的测试报告。
* 支持`HTML`、`XML`两种格式。
* 支持`单元`、`Web UI`、`API`各种类型的测试。
* 集成`邮件/钉钉/企微/飞书` 发送消息。
* 支持用例`错误/失败`重跑。
* 支持标签黑、白名单。
* 针对`Selenium`运行失败/错误自动截图。
* 支持多语言:`en`、`zh-CN`(注:仅HTML格式)。## Report

## Install
```shell
> pip install XTestRunner
```If you want to keep up with the latest version, you can install with github repository url:
```shell
> pip install -U git+https://github.com/SeldomQA/XTestRunner.git@master
```## demo
查看更多使用 [例子](./tests)。
* unittest测试
```python
import unittest
from XTestRunner import HTMLTestRunnerclass TestDemo(unittest.TestCase):
"""测试用例说明"""def test_success(self):
"""执行成功"""
self.assertEqual(2 + 3, 5)@unittest.skip("skip case")
def test_skip(self):
"""跳过用例"""
passdef 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='test report',
description='describe: ... ',
language='en',
rerun=3
)
runner.run(suit)
```## Document
更多例子,请阅读 [中文文档](./docs/README.md)
## 其他
### 感谢
感谢从以下项目中得到思路和帮助。
* [HTMLTestRunner](http://tungwaiyip.info/software/HTMLTestRunner.html)
* [HTMLTestRunner_cn](https://github.com/GoverSky/HTMLTestRunner_cn)
* [Theme style](https://clever-dashboard.webpixels.work/pages/tasks/list-view.html)
### 静态文件服务
1.添加静态文件到github项目。
https://github.com/defnngj/Telegraph-Image
2.cloudflare提供免费的访问域名。
https://dash.cloudflare.com/