Giter VIP home page Giter VIP logo

ztest's Introduction

ztest介绍

前言

ztest是一个测试报告,报告清晰简单,有饼图,汇总,运行详情。有兴趣的可以下载试用!

使用方式

将报告的json数据替换template文件中的${resultData}即可。

  1. pull ztest
  2. 读取template文件数据。
  3. 将测试报告数据json序列化。
  4. 用json序列化后的数据替换读取的template文件中的${resultData}。比如:
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
String template = FileUtil.read(templatePath);
template = template.replaceFirst("\\$\\{resultData\\}", gson.toJson(result));
output.write(template);
  1. 将替换后的数据写入一个html文件(比如report.html)即可。
  2. 测试报告数据格式示例:
{
    "testPass": 1,
    "testResult": [
        {
            "className": "com.test.testcase.TestDemo1",
            "methodName": "testDemo",
            "description": "测试DEMO",
            "spendTime": "11ms",
            "status": "成功",
            "log": [
                "this is demo!"
            ]
        }
    ],
    "testName": "20171109132744897",
    "testAll": 1,
    "testFail": 0,
    "beginTime": "2017-11-09 13:27:44.917",
    "totalTime": "11ms",
    "testSkip": 0
}

Java TestNg使用示例

请参考ztest中的TestDemo1.java ZTestReport.java

报告展示

ztest

鸣谢

感谢mock哥提供的python unittest实现部分,使用python unittest的同学可以无缝对接该报告!

mock哥git地址:mock哥git地址

junit5版本

junit5版本git地址:https://github.com/shenyanf/junitHtmlReport

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.