UnitAuto C++ 库,可通过 GitHub 仓库等远程依赖。
UnitAuto C++ Library for remote dependencies with GitHub repo, etc.
同步纯函数:
Sync pure function:
https://github.com/TommyLemon/unitauto-cpp/blob/main/unitauto/test/test_util.hpp#L25-L27
struct 成员函数:
strcut member function:
https://github.com/TommyLemon/unitauto-cpp/blob/main/main.cpp#L29-L31
class 成员函数:
class member function:
https://github.com/TommyLemon/unitauto-cpp/blob/main/main.cpp#L103-L106
代码覆盖率统计:
Code coverage:
https://cloud.tencent.com/developer/news/1309383
https://github.com/TommyLemon/unitauto-cpp/blob/main/unitauto/method_util.hpp
如果这个文件已经在你的项目中,只需要在 method_util.hpp 修正 #include "nlohmann/json.hpp" 为正确的路径
If this file already exists in your project, you need to correct #include "nlohmann/json.hpp" in method_util.hpp instead
https://github.com/TommyLemon/unitauto-cpp/blob/main/unitauto/nlohmann/json.hpp
由于 C++ 的语言限制,目前做不到像 Java, Kotlin 版几乎绝对零代码,还需要注册 func 和 struct/class 的实例。
Due to the limitation of C++, it's not almost absolutely coding free like Java and Kotlin,
and you need to write few code to register the funcs and structs to be tested.
https://github.com/TommyLemon/unitauto-cpp/blob/main/main.cpp#L226-L260
class: UNITAUTO_ADD_CLASS, eg: Moment
class Moment {
public:
long id;
long userId;
std::string content;
UNITAUTO_ADD_CLASS(Moment, id, userId, content)
};
struct: UNITAUTO_ADD_STRUCT, eg: User
struct User {
int id;
std::string name;
std::time_t date;
UNITAUTO_ADD_STRUCT(User, id, name, date)
};
static function: UNITAUTO_ADD_FUNC, method(member function): UNITAUTO_ADD_METHOD
// 注册普通函数,多个可以一起合并注册,超过 64 个可以分拆成多次调用
// Multiple functions(<= 64) can be register on one call
UNITAUTO_ADD_FUNC(add, divide, newMoment, unitauto::test::divide);
// 注册类型(class/struct)及方法(成员函数)
// Register type(class/struct) and method(member function)
UNITAUTO_ADD_METHOD(Moment, &Moment::getId, &Moment::setId, &Moment::getUserId, &Moment::setUserId, &Moment::getContent, &Moment::setContent);
UNITAUTO_ADD_METHOD(User, &User::getId, &User::setId, &User::getName, &User::setName, &User::getDate, &User::setDate);
UNITAUTO_ADD_METHOD(unitauto::test::TestUtil, &unitauto::test::TestUtil::divide);
https://github.com/TommyLemon/unitauto-cpp/blob/main/main.cpp#L269-L271
int main() {
unitauto::start(8084);
}
https://github.com/TommyLemon/UnitAuto
如果有什么问题或建议可以 去 APIAuto 提 issue,交流技术,分享经验。
如果你解决了某些 bug,或者新增了一些功能,欢迎 提 PR 贡献代码,感激不尽。
If you have any questions or suggestions, you can create an issue.
If you can added a feature or fixed a bug, please create a pull request, thank you~
创作不易、坚持更难,右上角点 ⭐ Star 支持下吧,谢谢 ^_^
Please ⭐ Star the repos that you like ^_^
UnitAuto 机器学习零代码单元测试平台,零代码、全方位、自动化 测试 方法/函数 的正确性、可用性和性能
unitauto-go UnitAuto Go 库,可通过 git 仓库等远程依赖
unitauto-py UnitAuto Python 库,可通过 pip 仓库等远程依赖
APIJSON 🚀 腾讯零代码、全功能、强安全 ORM 库 🏆 后端接口和文档零代码,前端(客户端) 定制返回 JSON 的数据和结构
APIAuto 敏捷开发最强大易用的 HTTP 接口工具,机器学习零代码测试、生成代码与静态检查、生成文档与光标悬浮注释,集 文档、测试、Mock、调试、管理 于一体的一站式体验
SQLAuto 智能零代码自动化测试 SQL 语句执行结果的数据库工具,任意增删改查、任意 SQL 模板变量、一键批量生成参数组合、快速构造大量测试数据
UIGO 📱 零代码快准稳 UI 智能录制回放平台 🚀 自动兼容任意宽高比分辨率屏幕,自动精准等待网络请求,录制回放快、准、稳!