{"id":15047551,"url":"https://github.com/tommylemon/unitauto-cpp","last_synced_at":"2026-03-02T04:03:43.445Z","repository":{"id":253663522,"uuid":"836349718","full_name":"TommyLemon/unitauto-cpp","owner":"TommyLemon","description":"UnitAuto - ☀️ 最先进、最省事、ROI 最高的单元测试，机器学习 零代码、全方位、自动化 测试 方法/函数，用户包含腾讯、快手、某 500 强巨头等。本项目为 C++ 版，支持 C++ 17 以上 ☀️ The most advanced unit testing way powered by machine learning. Coding-free, comprehensive and automatic testing for methods/functions. Used by Tencent, Kwai, a Fortune 500 company, etc. This repo is the C++ version, compat C++ 17+.","archived":false,"fork":false,"pushed_at":"2024-11-17T17:02:25.000Z","size":299,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-15T13:44:30.026Z","etag":null,"topics":["apiauto","apijson","cpp","cpp-library","cpp17","unit-test","unit-testing","unit-testing-library","unitauto","unitest","unittesting"],"latest_commit_sha":null,"homepage":"https://github.com/TommyLemon/UnitAuto","language":"C++","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/TommyLemon.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-07-31T16:54:43.000Z","updated_at":"2024-11-17T17:02:29.000Z","dependencies_parsed_at":"2024-09-08T16:50:48.631Z","dependency_job_id":"a9484620-7ee7-4388-b60b-47da4a785b48","html_url":"https://github.com/TommyLemon/unitauto-cpp","commit_stats":{"total_commits":34,"total_committers":2,"mean_commits":17.0,"dds":0.02941176470588236,"last_synced_commit":"f7739ba3301c0db9649811259af50ded9bc3b6b9"},"previous_names":["tommylemon/unitauto-cpp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TommyLemon/unitauto-cpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TommyLemon%2Funitauto-cpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TommyLemon%2Funitauto-cpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TommyLemon%2Funitauto-cpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TommyLemon%2Funitauto-cpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TommyLemon","download_url":"https://codeload.github.com/TommyLemon/unitauto-cpp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TommyLemon%2Funitauto-cpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29992286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["apiauto","apijson","cpp","cpp-library","cpp17","unit-test","unit-testing","unit-testing-library","unitauto","unitest","unittesting"],"created_at":"2024-09-24T21:00:04.523Z","updated_at":"2026-03-02T04:03:43.428Z","avatar_url":"https://github.com/TommyLemon.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unitauto-cpp \u003cimg src=\"https://img.shields.io/badge/C%2B%2B-17%2B-brightgreen.svg?style=flat\"\u003e\u003c/a\u003e\nUnitAuto C++ 库，可通过 GitHub 仓库等远程依赖。\u003cbr /\u003e\nUnitAuto C++ Library for remote dependencies with GitHub repo, etc.\n\n\n同步纯函数：\u003cbr /\u003e\nSync pure function: \u003cbr /\u003e\nhttps://github.com/TommyLemon/unitauto-cpp/blob/main/unitauto/test/test_util.hpp#L25-L27\n\u003cimg width=\"1493\" alt=\"image\" src=\"https://github.com/user-attachments/assets/71d78cbd-a850-4e83-9a2f-e758555c34e4\"\u003e\n\nstruct 成员函数：\u003cbr /\u003e\nstrcut member function: \u003cbr /\u003e\nhttps://github.com/TommyLemon/unitauto-cpp/blob/main/main.cpp#L29-L31\n\u003cimg width=\"1219\" alt=\"image\" src=\"https://github.com/user-attachments/assets/e928d420-41ef-4aae-940b-2de8042d4bed\"\u003e\n\nclass 成员函数：\u003cbr /\u003e\nclass member function: \u003cbr /\u003e\nhttps://github.com/TommyLemon/unitauto-cpp/blob/main/main.cpp#L103-L106\n\u003cimg width=\"1219\" alt=\"image\" src=\"https://github.com/user-attachments/assets/034d5768-a224-49c8-be14-41f7e6a2161b\"\u003e\n\n\u003cbr /\u003e\n\n代码覆盖率统计：\u003cbr /\u003e\nCode coverage: \u003cbr /\u003e\nhttps://cloud.tencent.com/developer/news/1309383\n\n\u003cbr /\u003e\n\n#### 1. 复制粘贴 method_util.hpp \u0026 nlohmann/json.hpp 到你的项目\n#### 1. Copy \u0026 Paste method_util.hpp \u0026 nlohmann/json.hpp to your project\nhttps://github.com/TommyLemon/unitauto-cpp/blob/main/unitauto/method_util.hpp\n\u003cbr /\u003e\n\n如果这个文件已经在你的项目中，只需要在 method_util.hpp 修正 #include \"[nlohmann/json.hpp](https://github.com/nlohmann/json)\" 为正确的路径  \u003cbr /\u003e\nIf this file already exists in your project, you need to correct #include \"[nlohmann/json.hpp](https://github.com/nlohmann/json)\" in method_util.hpp instead\nhttps://github.com/TommyLemon/unitauto-cpp/blob/main/unitauto/nlohmann/json.hpp\n\n\u003cbr /\u003e\n\n#### 2. 注册类型(class/strcut)和函数\n#### 2. Register type(class/strcut) and function\n由于 C++ 的语言限制，目前做不到像 Java, Kotlin 版几乎绝对零代码，还需要注册 func 和 struct/class 的实例。\u003cbr /\u003e\nDue to the limitation of C++, it's not almost absolutely coding free like Java and Kotlin, \u003cbr /\u003e\nand you need to write few code to register the funcs and structs to be tested. \u003cbr /\u003e\nhttps://github.com/TommyLemon/unitauto-cpp/blob/main/main.cpp#L226-L260\n\u003cbr /\u003e\n\nclass: UNITAUTO_ADD_CLASS, eg: Moment\n```c++\nclass Moment {\npublic:\n    long id;\n    long userId;\n    std::string content;\n\n    UNITAUTO_ADD_CLASS(Moment, id, userId, content)\n};\n```\n\u003cb /\u003e\n\nstruct: UNITAUTO_ADD_STRUCT, eg: User\n```c++\nstruct User {\n    int id;\n    std::string name;\n    std::time_t date;\n\n    UNITAUTO_ADD_STRUCT(User, id, name, date)\n};\n```\n\u003cb /\u003e\n\nstatic function: UNITAUTO_ADD_FUNC, method(member function): UNITAUTO_ADD_METHOD\n```c++\n    // 注册普通函数，多个可以一起合并注册，超过 64 个可以分拆成多次调用\n    // Multiple functions(\u003c= 64) can be register on one call\n    UNITAUTO_ADD_FUNC(add, divide, newMoment, unitauto::test::divide);\n\n    // 注册类型(class/struct)及方法(成员函数)\n    // Register type(class/struct) and method(member function)\n    UNITAUTO_ADD_METHOD(Moment, \u0026Moment::getId, \u0026Moment::setId, \u0026Moment::getUserId, \u0026Moment::setUserId, \u0026Moment::getContent, \u0026Moment::setContent);\n    UNITAUTO_ADD_METHOD(User, \u0026User::getId, \u0026User::setId, \u0026User::getName, \u0026User::setName, \u0026User::getDate, \u0026User::setDate);\n    UNITAUTO_ADD_METHOD(unitauto::test::TestUtil, \u0026unitauto::test::TestUtil::divide);\n```\n\u003cbr /\u003e\n\n#### 3. 启动单元测试服务\n#### 3. Start unit testing server\nhttps://github.com/TommyLemon/unitauto-cpp/blob/main/main.cpp#L269-L271\n```c++\nint main() {\n    unitauto::start(8084);\n}\n```\n\n\u003cbr /\u003e\n\n#### 4. 参考主项目文档来测试\n#### 4. Test by following the main repo\n\nhttps://github.com/TommyLemon/UnitAuto\n\n\u003cbr /\u003e\n\n### 5. 关于作者\n### 5. Author\n[https://github.com/TommyLemon](https://github.com/TommyLemon) \u003cbr /\u003e\n\u003cimg width=\"1280\" src=\"https://github.com/TommyLemon/UIGO/assets/5738175/ec77df98-ff9b-43aa-b2f1-2fce2549d276\"\u003e\n\n如果有什么问题或建议可以 [去 APIAuto 提 issue](https://github.com/TommyLemon/APIAuto/issues)，交流技术，分享经验。\u003cbr \u003e\n如果你解决了某些 bug，或者新增了一些功能，欢迎 [提 PR 贡献代码](https://github.com/Tencent/APIJSON/blob/master/CONTRIBUTING.md)，感激不尽。\n\u003cbr /\u003e\nIf you have any questions or suggestions, you can [create an issue](https://github.com/TommyLemon/APIAuto/issues). \u003cbr \u003e\nIf you can added a feature or fixed a bug, please [create a pull request](https://github.com/TommyLemon/unitauto-cpp/pulls), thank you~\n\n\n### 6. 其它项目\n### 6. Link\n创作不易、坚持更难，右上角点 ⭐ Star 支持下吧，谢谢 ^\\_^ \u003cbr /\u003e\nPlease ⭐ Star the repos that you like ^\\_^ \u003cbr /\u003e\n\n[UnitAuto](https://github.com/TommyLemon/UnitAuto) 机器学习零代码单元测试平台，零代码、全方位、自动化 测试 方法/函数 的正确性、可用性和性能\n\n[unitauto-go](https://github.com/TommyLemon/unitauto-go) UnitAuto Go 库，可通过 git 仓库等远程依赖\n\n[unitauto-py](https://github.com/TommyLemon/unitauto-py) UnitAuto Python 库，可通过 pip 仓库等远程依赖\n\n[APIJSON](https://github.com/Tencent/APIJSON) 🚀 腾讯零代码、全功能、强安全 ORM 库 🏆 后端接口和文档零代码，前端(客户端) 定制返回 JSON 的数据和结构\n\n[APIAuto](https://github.com/TommyLemon/APIAuto) 敏捷开发最强大易用的 HTTP 接口工具，机器学习零代码测试、生成代码与静态检查、生成文档与光标悬浮注释，集 文档、测试、Mock、调试、管理 于一体的一站式体验\n\n[SQLAuto](https://github.com/TommyLemon/SQLAuto) 智能零代码自动化测试 SQL 语句执行结果的数据库工具，任意增删改查、任意 SQL 模板变量、一键批量生成参数组合、快速构造大量测试数据\n\n[UIGO](https://github.com/TommyLemon/UIGO) 📱 零代码快准稳 UI 智能录制回放平台 🚀 自动兼容任意宽高比分辨率屏幕，自动精准等待网络请求，录制回放快、准、稳！\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommylemon%2Funitauto-cpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftommylemon%2Funitauto-cpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftommylemon%2Funitauto-cpp/lists"}