{"id":16632697,"url":"https://github.com/qualitysphere/hrobot","last_synced_at":"2025-04-30T16:22:58.568Z","repository":{"id":62569504,"uuid":"416135338","full_name":"QualitySphere/hRobot","owner":"QualitySphere","description":"Hybrid Robot 基于 RobotFramework 的二次封装","archived":false,"fork":false,"pushed_at":"2021-12-28T06:36:58.000Z","size":222,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T09:16:13.751Z","etag":null,"topics":["allure","allure-report","automation","excel","python","python3","robotframework","testing"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QualitySphere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-12T01:03:39.000Z","updated_at":"2021-12-28T06:32:52.000Z","dependencies_parsed_at":"2022-11-03T17:15:27.188Z","dependency_job_id":null,"html_url":"https://github.com/QualitySphere/hRobot","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QualitySphere%2FhRobot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QualitySphere%2FhRobot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QualitySphere%2FhRobot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QualitySphere%2FhRobot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QualitySphere","download_url":"https://codeload.github.com/QualitySphere/hRobot/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251740349,"owners_count":21636035,"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":["allure","allure-report","automation","excel","python","python3","robotframework","testing"],"created_at":"2024-10-12T05:09:52.418Z","updated_at":"2025-04-30T16:22:58.544Z","avatar_url":"https://github.com/QualitySphere.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hybrid Robot\n\n基于 RobotFramework 的二次封装\n\n\u003e **注意**\n\u003e \n\u003e 该方案是对 RobotFramework 的二次封装，以减轻中国用户使用符合欧美用户习惯的原生 RobotFramework 时的不适，因此，该方案并**不适合**所有场景。针对技术能力暂时薄弱、英文能力差的中小团队，可能具有一定的疗效。\n\n[![org](https://img.shields.io/static/v1?style=for-the-badge\u0026label=org\u0026message=Assurance%20Sphere\u0026color=ff582c)](https://will.bowxeon.com)\n![License](https://img.shields.io/github/license/qualitysphere/hrobot?style=for-the-badge)\n![author](https://img.shields.io/static/v1?style=for-the-badge\u0026label=author\u0026message=362639663@qq.com\u0026color=blue)\n![author](https://img.shields.io/static/v1?style=for-the-badge\u0026label=author\u0026message=v.stone@163.com\u0026color=blue)\n[![Python](https://img.shields.io/static/v1?style=for-the-badge\u0026logo=python\u0026label=Python\u0026message=3.8\u0026color=306ba1)](https://docs.python.org/release/3.8.11/)\n[![PyPI](https://img.shields.io/pypi/v/hrobot.svg?style=for-the-badge)](https://pypi.org/project/hrobot/)\n\n## 重点改造描述\n\n- 用 Excel 取代 .robot 文件进行测试用例的编写\n- 增加命令行脚手架工具，一键初始化测试项目，不需要额外学习如何自己搭建目录结构\n- 精简固化用法，高级用法被封装隐藏\n- 集成 Allure 测试报告框架\n- 检测到系统为非 Windows/Mac 系统时，将增加环境变量 `HROBOT_BROWSER_MODE=headless`，Chrome 将不启动图形界面\n- 安装时会集成常用于测试场景的 Python 库，如: requests, selenium, paramiko\n\n## 快速开始\n\n#### 安装\n\n```bash\npip install hrobot\n```\n\n#### 执行 `hrobot` 检查\n\n```text\nhrobot\n  init     初始化项目目录\n  run      执行测试用例\n  debug    调试测试用例，支持选择用例集、测试用例、标签\n  report   生成并展示测试报告\n  version  显示版本信息\n```\n\n#### 初始化测试用例项目\n\n使用 `hrobot init` 初始化项目目录\n\n```text\nhrobot init \n  -p    project  定义一个测试项目目录的名称\n```\n\n进入到项目目录中后，文件树接口如下：\n\n```text\n\u003cprojectName\u003e\n├── testcases\n│   └── suites.xlsx\n├── keywords\n│   └── keywords.xlsx\n└── variables\n    └── variables.xlsx\n```\n\n*PS: keywords 暂无实际作用*  \n\n#### 编写测试用例 \n\n通过 Excel 打开 testcases 目录中的 suite.xlsx 文件，有 5 个 Sheet，每个 Sheet 有自己的表头:\n\n- 用例\n\n  \u003cimg src=\"https://qualitysphere.gitee.io/img/hrobot-suite.png\" width=\"800\"\u003e\n\n- 变量\n\n  \u003cimg src=\"https://qualitysphere.gitee.io/img/hrobot-variable.png\" width=\"480\"\u003e\n  \n- 前置\n\n  \u003cimg src=\"https://qualitysphere.gitee.io/img/hrobot-setup.png\" width=\"480\"\u003e\n\n- 后置\n\n  \u003cimg src=\"https://qualitysphere.gitee.io/img/hrobot-setup.png\" width=\"480\"\u003e\n  \n- 可用关键字\n\n  \u003cimg src=\"https://qualitysphere.gitee.io/img/hrobot-setup.png\" width=\"480\"\u003e\n\n例子：\n\n  \u003cbr\u003e|A|B|C|D|E|F|G|H\n  ----|----|----|----|----|----|----|----|---\n  1 |用例标题|标签|用例描述|关键字库|关键字|参数|\n  2 |SSH远程后再调用 HTTP 接口 |\u003cbr\u003e|\u003cbr\u003e| 远程 | 执行 | root | password | whoami\n  3 |\u003cbr\u003e |\u003cbr\u003e|\u003cbr\u003e|接口| GET | https://xxx/api/info | {\"Content-Type\":\"application/json\"}\n  4 |HTTP 接口请求后断言 |\u003cbr\u003e|\u003cbr\u003e| 接口 | POST | https://xxx/api/products | {\"Content-Type\":\"application/json | {\"project_owner\":\"jing\"}\n  5 |\u003cbr\u003e |\u003cbr\u003e|\u003cbr\u003e| 接口 | 响应.断言 | status_code | 等于 | 200\n  6 |\u003cbr\u003e |\u003cbr\u003e|\u003cbr\u003e| 接口| 响应.断言 | body.data.0.name | 等于 | hrobot\n  7 |HTTP 返回值获取 |\u003cbr\u003e|\u003cbr\u003e| 接口 | POST | https://xxx/api/login | {\"Content-Type\":\"application/json\"} | {\"username\":\"jing\"}\n  8 |\u003cbr\u003e |\u003cbr\u003e|\u003cbr\u003e| 接口| 响应.取值 | body.token | AUTH\n  9 |\u003cbr\u003e |\u003cbr\u003e|\u003cbr\u003e| 接口| GET | https://xxx/api/info | {\"Content-Type\":\"application/json\",\"Authorization\":\"${AUTH}\"} \n  10|\u003cbr\u003e |\u003cbr\u003e|\u003cbr\u003e| 接口| 响应.断言 | status_code | 等于 | 200\n  11|\u003cbr\u003e |\u003cbr\u003e|\u003cbr\u003e| 接口 | 响应.断言 | body.username | 等于 | jing\n\n#### 执行用例\n\n```bash\ncd \u003cprojectName\u003e\nhrobot run\n```\n\n#### 生成报告\n\n```bash\nhrobot report\n```\n\n## 定义变量\n\n变量有三个级别：用例、用例集、全局，均可以在测试用例的 Excel 编写中通过关键字定义。\n\n除此之外，也可以在用例集的 Excel 的 \"变量\" Sheet 中提前定义好用例集级别的变量。\n\n全局变量还可以在 variables 目录下的 Excel 中定义，该处定义的全局变量会在报告的环境信息段落中展现。\n\n\u003cimg src=\"https://qualitysphere.gitee.io/img/hrobot-variable.png\" width=\"480\"\u003e\n\n## 自定义关键字\n\n- 待设计\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqualitysphere%2Fhrobot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqualitysphere%2Fhrobot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqualitysphere%2Fhrobot/lists"}