Repository: findyou/HTMLTestRunnerCN
Branch: master
Commit: 67c8c005d52c
Files: 11
Total size: 130.8 KB
Directory structure:
gitextract_hp85jjlx/
├── README.md
├── Report_CN.html
├── Report_EN.html
├── python2x/
│ ├── HTMLTestRunnerCN.py
│ ├── HTMLTestRunnerEN.py
│ ├── test_HTMLTestRunnerCN.py
│ └── test_HTMLTestRunnerEN.py
└── python3x/
├── HTMLTestReportCN.py
├── HTMLTestReportEN.py
├── test_HTMLTestReportCN.py
└── test_HTMLTestReportEN.py
================================================
FILE CONTENTS
================================================
================================================
FILE: README.md
================================================
[最新版本]
https://github.com/findyou/HTMLTestRunnerCN/tree/dev
```python
* Version 0.8.3 20171206 -Findyou
# BUG fixed :错误的测试用例没有统计与显示
# BUG fixed :当PASS的测试用例有print内容时,通过按钮显示为红色
# 表格背景颜色根据用例结果显示颜色,优先级: 错误(黄色)>失败(红色)>通过(绿色)
# 合并文为HTMLTestRunner*N.py 同时支持python2,python3
```
[说明]
=========================
HTMLTestRunner输出的报告真的很丑,于是找了一圈没有我自已想要的html,所以自己动手进行了美化
原作者文件下载地址:http://tungwaiyip.info/software/HTMLTestRunner.html
我基于其Version 0.8.2进行了修改美化具体内容如下:
```python
Version 20170609 -Findyou
* python3x #仅支持python3x
# Version 0.8.2.2
# HTMLTestReportCN.py 中文报告
# HTMLTestReportEN.py 英文报告
* python2x #仅支持python2x
# Version 0.8.2.1
# HTMLTestRunnerEN.py 中文报告
# HTMLTestRunnerCN.py 英文报告
Version 0.8.2.1 -Findyou
* CN汉化,EN保留英文,加Utf-8支持报告中文字符
* 增加 样式美化(需要网络)
* 增加 通过用例 分类按钮
* 增加 测试人员显示、通过率的统计
* 增加 按钮显示相应用例数
* 修改 测试结果的展示,方便拷贝数据
* 修改“详细”逻辑,增加与“收起”效果变换
* 右侧底部增加 返回 顶部的锚点
```
[如何使用]
=========================
一、HTMLTestRunnerEN(python2.x) 使用
--------------------------
有时大伙会觉得英语会有莫名的逼格(感叹,沉默),所以保留了英文显示,满足大家的需要,报告内容支持中文显示。
* 编写test_HTMLTestRunnerEN.py
```python
import HTMLTestRunnerEN
...
if __name__ == '__main__':
filePath ='F:\\Report.html'
fp = file(filePath,'wb')
runner = HTMLTestRunnerEN.HTMLTestRunner(
stream=fp,
title='{ Test Report }',
#description='',
#tester="Findyou"
)
runner.run(Suite())
```
* 执行test_HTMLTestRunnerEN.py
```python
python test_HTMLTestRunnerEN.py
```
* 执行结果:Report.html

二、HTMLTestRunnerCN(python2.x) 使用
--------------------------
使用同HTMLTestRunnerEN,无区别
* 执行结果:Report.html

三、HTMLTestReportCN(python3.x) 使用
--------------------------
使用同HTMLTestRunnerEN,无区别
四、HTMLTestReportEN(python3.x) 使用
--------------------------
使用同HTMLTestRunnerEN,无区别
================================================
FILE: Report_CN.html
================================================
测试人员 : Findyou
开始时间 : 2017-05-31 12:00:55
合计耗时 : 0:00:00.001000
测试结果 : 共 11,通过 6,失败 5,通过率= 54.55%
概要{ 54.55% } 失败{ 5 } 通过{ 6 } 所有{ 11 }
| 用例集/测试用例 | 总计 | 通过 | 失败 | 错误 | 详细 |
| MyTestCase | 5 | 2 | 3 | 0 | 详细 |
testCase1 |
通过 | ||||
testCase2 |
ft1_2: Traceback (most recent call last):
File "test_html.py", line 23, in testCase2
self.assertEqual(2,3,"testError")
AssertionError: testError
|
||||
testCase3 |
ft1_3: Traceback (most recent call last):
File "test_html.py", line 26, in testCase3
self.assertEqual(2,5,"测试错误")
AssertionError: 测试错误
|
||||
testCase4 |
ft1_4: Traceback (most recent call last):
File "test_html.py", line 29, in testCase4
self.assertEqual(2,1,"测试错误")
AssertionError: 测试错误
|
||||
testCase5 |
通过 | ||||
| APITestCase | 6 | 4 | 2 | 0 | 详细 |
testCase1 |
通过 | ||||
testCase2 |
通过 | ||||
testCase3 |
通过 | ||||
testCase4 |
ft2_4: Traceback (most recent call last):
File "test_html.py", line 51, in testCase4
self.assertEqual(2, 1, "测试错误")
AssertionError: 测试错误
|
||||
testCase5 |
ft2_5: Traceback (most recent call last):
File "test_html.py", line 54, in testCase5
self.assertEqual(2, 9, "testError")
AssertionError: testError
|
||||
testCase6 |
通过 | ||||
| 总计 | 11 | 6 | 5 | 0 | 通过率:54.55% |
Tester : Findyou
Start Time : 2017-05-31 13:01:29
Duration : 0:00:00.001000
Status : ALL 11 Pass 6 Failure 5, Passing rate: 54.55%
Summary{ 54.55% } Failed{ 5 } Passed{ 6 } ALL{ 11 }
| Test Group/Test case | Count | Pass | Fail | Error | View |
| MyTestCase | 5 | 2 | 3 | 0 | Detail |
testCase1 |
pass | ||||
testCase2 |
ft1_2: Traceback (most recent call last):
File "test_HTMLTestRunnerEN.py", line 23, in testCase2
self.assertEqual(2,3,"testError")
AssertionError: testError
|
||||
testCase3 |
ft1_3: Traceback (most recent call last):
File "test_HTMLTestRunnerEN.py", line 26, in testCase3
self.assertEqual(2,5,"测试错误")
AssertionError: 测试错误
|
||||
testCase4 |
ft1_4: Traceback (most recent call last):
File "test_HTMLTestRunnerEN.py", line 29, in testCase4
self.assertEqual(2,1,"测试错误")
AssertionError: 测试错误
|
||||
testCase5 |
pass | ||||
| APITestCase | 6 | 4 | 2 | 0 | Detail |
testCase1 |
pass | ||||
testCase2 |
pass | ||||
testCase3 |
pass | ||||
testCase4 |
ft2_4: Traceback (most recent call last):
File "test_HTMLTestRunnerEN.py", line 51, in testCase4
self.assertEqual(2, 1, "测试错误")
AssertionError: 测试错误
|
||||
testCase5 |
ft2_5: Traceback (most recent call last):
File "test_HTMLTestRunnerEN.py", line 54, in testCase5
self.assertEqual(2, 6, "testError")
AssertionError: testError
|
||||
testCase6 |
pass | ||||
| Total | 11 | 6 | 5 | 0 | Passing rate: 54.55% |