All Projects → GoverSky → HTMLTestRunner_cn

GoverSky / HTMLTestRunner_cn

Licence: other
HTMLTestRunner 汉化版,同时支持python 2和3,增加截图展示功能,失败重试

Projects that are alternatives of or similar to HTMLTestRunner cn

Interface TestPlatform
python3+django+requests+ddt+unittest接口自动化测试平台
Stars: ✭ 52 (-72.77%)
Mutual labels:  unittest, htmltestrunner
unittest expander
A library that provides flexible and easy-to-use tools to parameterize Python unit tests, especially those based on unittest.TestCase.
Stars: ✭ 12 (-93.72%)
Mutual labels:  unittest
refer
Cross browser web clipper. Takes notes from videos, screenshots and extract texts or images from supported web browsers.
Stars: ✭ 21 (-89.01%)
Mutual labels:  screenshots
jest-puppe-shots
A Jest plugin for creating screenshots of React components with a little help of Puppeteer
Stars: ✭ 86 (-54.97%)
Mutual labels:  unittest
php-backoff
Simple back off / retry functionality
Stars: ✭ 24 (-87.43%)
Mutual labels:  retry
pika
Quickly design beautiful screenshots and open graph images
Stars: ✭ 412 (+115.71%)
Mutual labels:  screenshots
AutoScreenshot
Automatic screenshot maker for Windows
Stars: ✭ 49 (-74.35%)
Mutual labels:  screenshots
screenshot
Swiftly grab pretty images of your code
Stars: ✭ 158 (-17.28%)
Mutual labels:  screenshots
randunit
Bring unittest to your Android/JVM applications with tiny effort.
Stars: ✭ 33 (-82.72%)
Mutual labels:  unittest
java-sdk
一些常用的java sdk和工具类(日期工具类,分布式锁,redis缓存,二叉树,反射工具类,线程池,对称/非对称/分段加解密,json序列化,http工具,雪花算法,字符串相似度,集合操作工具,xml解析,重试Retry工具类,Jvm监控等)
Stars: ✭ 26 (-86.39%)
Mutual labels:  retry
guest3
No description or website provided.
Stars: ✭ 51 (-73.3%)
Mutual labels:  unittest
TestIt
Generate unit testing boilerplate from kotlin files.
Stars: ✭ 32 (-83.25%)
Mutual labels:  unittest
XUnit.jl
XUnit.jl is a unit-testing framework for Julia.
Stars: ✭ 32 (-83.25%)
Mutual labels:  unittest
ee.Screen
Takes screenshots of web pages for the list of URLs. Various resolutions, multiple formats (JPG, PDF, PNG and TXT)
Stars: ✭ 19 (-90.05%)
Mutual labels:  screenshots
PizzaDelivery
Pizza Delivery is an open source sample app with robust and professional features. This is a fully realized built entirely in Swift.
Stars: ✭ 20 (-89.53%)
Mutual labels:  unittest
VCore
VCore is a Swift collection containing objects, functions, and extensions that I use for my projects
Stars: ✭ 32 (-83.25%)
Mutual labels:  unittest
autoscreen
Automated screen capture utility
Stars: ✭ 76 (-60.21%)
Mutual labels:  screenshots
SWRATT
🤖 ☠️ 💬 A simple Telegram Bot that controls the victim's computer.
Stars: ✭ 38 (-80.1%)
Mutual labels:  screenshots
RocketXDelight-Playground
Native Android application built with Kotlin and Jetpack Compose. This project also illustrates the usage of advanced libraries such as Ktor, SqlDelight, Hilt, etc with the recommended practices and Unit Tests.
Stars: ✭ 37 (-80.63%)
Mutual labels:  unittest
retryx
Promise-based retry workflow library.
Stars: ✭ 21 (-89.01%)
Mutual labels:  retry

HTMLTestRunner 汉化版

在原版的基础上进行扩展和改造

当年改造初衷

  • 方便自己做汉化报告生成
  • 对自己积累知识的检验
  • 挑战下单文件报告都能做出什么花样 近两年不怎么搞UI自动化了,项目就一直没怎么更新(pytest香啊😅

todo

  • 多线程/多进程执行用例(数据统计逻辑要重新设计,还有兼容性问题😑
  • UI 美化 (通过CDN集成一些成熟的js库~然后加5毛钱特效😜)
  • 与ddt的集成(目测基本就把源码收进来😏

报告汉化,错误日志

selenium/appium 截图

截图功能根据测试结果,当结果为fail或error时自动截图
截图方法在_TestResult 的测试结果收集中,报告使用的截图全部保存为base64编码,避免了报告图片附件的问题,可以根据自己使用的框架不同自行调整,selenium 使用的是get_screenshot_as_base64 方法获取页面截图的base64编码
因为要提取用例中的driver变量获取webdriver对象,所以要实现截图功能必须定义在用例中定义webdriver 为driver

    def setUp(self):
        self.imgs=[]  # (可选)初始化截图列表
        self.driver = webdriver.Chrome()

或者

    @classmethod
    def setUpClass(cls):
        cls.driver = webdriver.Chrome()

也可以在测试过程中某一步骤自定义添加截图,比如

生成报告后会统一进行展示
Selenium截图轮播效果

Appium效果轮播截图

用例失败重试

根据unittest的运行机制,在stopTest 中判断测试结果,如果失败或出错status为1,判断是否需要重试;

在实例化HTMLTestRunner 对象时追加参数,retry,指定重试次数,如果save_last_try 为True ,一个用例仅显示最后一次测试的结果。

HTMLTestRunner(title="带截图的测试报告", description="小试牛刀", stream=open("sample_test_report.html", "wb"), verbosity=2, retry=2, save_last_try=True)

如果save_last_try 为False,则显示所有重试的结果。

HTMLTestRunner(title="带截图的测试报告", description="小试牛刀", stream=open("sample_test_report.html", "wb"), verbosity=2, retry=2, save_last_try=False)

运行中输出效果如下:

注意:在python3 中因为unittest运行机制变动,在使用setUp/tearDown中初始化/退出driver时,会出现用例执行失败没有截图的问题,所以推荐使用样例中setUpClass/tearDownClass的用法

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].