{"id":13337340,"url":"https://github.com/zhangfei19841004/ztest","last_synced_at":"2025-03-11T04:32:47.923Z","repository":{"id":44729076,"uuid":"108509500","full_name":"zhangfei19841004/ztest","owner":"zhangfei19841004","description":"自动化测试报告","archived":false,"fork":false,"pushed_at":"2020-03-30T04:33:12.000Z","size":5062,"stargazers_count":189,"open_issues_count":3,"forks_count":112,"subscribers_count":19,"default_branch":"master","last_synced_at":"2024-07-30T20:52:30.937Z","etag":null,"topics":["automation","report","test","test-automation","testing","testng-reports"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhangfei19841004.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-27T06:44:51.000Z","updated_at":"2024-06-24T01:28:46.000Z","dependencies_parsed_at":"2022-08-30T03:50:52.644Z","dependency_job_id":null,"html_url":"https://github.com/zhangfei19841004/ztest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangfei19841004%2Fztest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangfei19841004%2Fztest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangfei19841004%2Fztest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangfei19841004%2Fztest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhangfei19841004","download_url":"https://codeload.github.com/zhangfei19841004/ztest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221205823,"owners_count":16776285,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","report","test","test-automation","testing","testng-reports"],"created_at":"2024-07-29T19:13:43.759Z","updated_at":"2024-10-23T15:32:48.177Z","avatar_url":"https://github.com/zhangfei19841004.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ztest介绍\n\n## 前言\n\nztest是一个测试报告，报告清晰简单，有饼图，汇总，运行详情。有兴趣的可以下载试用！\n\n## 使用方式\n\n\u003e 将报告的json数据替换template文件中的`${resultData}`即可。\n\n1. pull [ztest](https://github.com/zhangfei19841004/ztest)。\n2. 读取template文件数据。\n3. 将测试报告数据json序列化。\n4. 用json序列化后的数据替换读取的template文件中的`${resultData}`。比如：\n\n```\nGson gson = new GsonBuilder().disableHtmlEscaping().create();\nString template = FileUtil.read(templatePath);\ntemplate = template.replaceFirst(\"\\\\$\\\\{resultData\\\\}\", gson.toJson(result));\noutput.write(template);\n```\n\n5. 将替换后的数据写入一个html文件(比如report.html)即可。\n6. 测试报告数据格式示例：\n\n```\n{\n    \"testPass\": 1,\n    \"testResult\": [\n        {\n            \"className\": \"com.test.testcase.TestDemo1\",\n            \"methodName\": \"testDemo\",\n            \"description\": \"测试DEMO\",\n            \"spendTime\": \"11ms\",\n            \"status\": \"成功\",\n            \"log\": [\n                \"this is demo!\"\n            ]\n        }\n    ],\n    \"testName\": \"20171109132744897\",\n    \"testAll\": 1,\n    \"testFail\": 0,\n    \"beginTime\": \"2017-11-09 13:27:44.917\",\n    \"totalTime\": \"11ms\",\n    \"testSkip\": 0\n}\n```\n\n## Java TestNg使用示例\n\n请参考[ztest](https://github.com/zhangfei19841004/ztest)中的`TestDemo1.java ZTestReport.java`\n\n## 报告展示\n\n![ztest](https://github.com/zhangfei19841004/ztest/blob/master/ztest.png)\n\n## 鸣谢\n\n感谢mock哥提供的python unittest实现部分，使用python unittest的同学可以无缝对接该报告！\n\nmock哥git地址：[mock哥git地址](https://github.com/TesterlifeRaymond/BeautifulReport)\n\n## junit5版本\n\njunit5版本git地址:[https://github.com/shenyanf/junitHtmlReport](https://github.com/shenyanf/junitHtmlReport)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangfei19841004%2Fztest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhangfei19841004%2Fztest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangfei19841004%2Fztest/lists"}