GithubHelp home page GithubHelp logo

bredchu / htmltestrunner Goto Github PK

View Code? Open in Web Editor NEW

This project forked from goversky/htmltestrunner_cn

0.0 1.0 0.0 2.28 MB

HTMLTestRunner 汉化版,同时支持python 2和3,增加截图功能

Python 3.08% HTML 96.92%

htmltestrunner's Introduction

HTMLTestRunner 汉化版

在原作者的基础上对整个测试报告进行了汉化处理 此版本增加了如下功能

  • 测试报告完全汉化,包括错误日志的中文处理
  • 针对selenium UI测试增加失败自动截图功能
  • 增加失败自动重试功能
  • 增加饼图统计
  • 同时兼容python2.x 和3.x

#报告汉化

selenium 截图

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

def setUp(self):
    self.driver = webdriver.Chrome()

效果

用例失败重试

在实例化HTMLTestRunner 对象时追加参数,retry,指定重试次数,重试的测试也会收集到测试报告中。 HTMLTestRunner(title="带截图的测试报告",description="小试牛刀",stream=open("test1.html","wb"),verbosity=2,retry=1)

htmltestrunner's People

Contributors

goversky avatar tungwaiyip avatar

Watchers

Bred Chu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.