返回顶部
g

grpc-test-automation

|

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
52
下载量
0
收藏
概述
安装方式
版本历史

grpc-test-automation

# gRPC Test Automation for Embedded Devices Automated framework for testing C/C++ SDK on embedded boards via gRPC + JMeter. ## Complete Workflow ``` ┌─────────────────────────────────────────────────────────────────┐ │ 输入: 需求文档 + C/C++ SDK (头文件 + 库) │ └─────────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────────┐ │ Step 1: 分析 SDK 头文件 │ │ - 提取函数签名 │ │ - 识别错误码枚举 │ │ - 理解数据结构 │ └─────────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────────┐ │ Step 2: 编写 C++ gRPC 服务端 │ │ - 创建 Proto 文件 (基于 SDK 接口) │ │ - 实现 gRPC 服务类 (封装 SDK 调用) │ │ - 编写 CMakeLists.txt │ └─────────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────────┐ │ Step 3: 编译生成 │ │ - cmake + make → 生成可执行文件 │ │ - protoc → 生成 proto descriptor (.protobin) │ └─────────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────────┐ │ Step 4: 编写 JMeter JMX │ │ - 引用 proto descriptor │ │ - 配置 gRPC Sampler │ │ - 定义测试用例 │ └─────────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────────┐ │ Step 5: 串口下发资源到板端 │ │ - 模拟串口通信 (TCP Socket) │ │ - 下发: SDK库 + 服务程序 + Proto │ │ - 挂载到板端目录 │ └─────────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────────┐ │ Step 6: 板端拉起服务 │ │ - 设置 LD_LIBRARY_PATH │ │ - 执行 ./grpc_server 8080 │ └─────────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────────┐ │ Step 7: JMeter 执行测试 │ │ - jmeter -n -t test.jmx │ │ - 收集响应数据 │ └─────────────────────────────────────────────────────────────────┘ ↓ ┌─────────────────────────────────────────────────────────────────┐ │ Step 8: 生成 Excel 报告 │ │ - 测试概览 │ │ - 测试详情 │ │ - 性能指标 │ │ - 错误详情 │ └─────────────────────────────────────────────────────────────────┘ ``` ## Input Files ### Required - `sdk/include/*.h` - SDK header files - `sdk/lib/*.so` or `sdk/lib/*.a` - SDK libraries ### Optional - `requirements.md` - Interface specifications - `test_cases.md` - Historical test cases - `test_framework/` - Historical framework code ## Output Structure ``` grpc_test/ ├── proto/ │ └── service.proto # Generated from SDK analysis ├── server/ │ ├── CMakeLists.txt # Build configuration │ ├── grpc_server.cpp # gRPC server (wraps SDK) │ ├── build/ # Build output │ │ ├── grpc_server # Compiled executable │ │ └── service.protobin # Proto descriptor for JMeter │ └── service.pb.h/cc # Generated protobuf code ├── client/ │ └── test_client.cpp # Optional test client ├── jmeter/ │ ├── test_plans/ │ │ └── test.jmx # JMeter test plan │ ├── results/ │ │ ├── result.jtl # Raw results │ │ └── report.xlsx # Excel report │ └── service.protobin # Proto descriptor (copied) ├── scripts/ │ ├── serial_simulator.py # Serial communication simulator │ ├── deploy_to_board.sh # Deploy resources to board │ ├── run_server.sh # Start server on board │ └── run_tests.sh # Execute full test cycle └── sdk/ # Original SDK (mounted to board) ├── include/ └── lib/ ``` ## Scripts Usage ### 1. Analyze SDK Headers ```python scripts/analyze_sdk.py sdk/include/ ``` Extracts: functions, enums, structs, error codes ### 2. Generate Proto + Server ```python scripts/generate_grpc_server.py --sdk sdk/ --output server/ ``` Creates: proto file, server.cpp, CMakeLists.txt ### 3. Build ```bash cd server/build && cmake .. && make ``` Generates: grpc_server executable, service.protobin ### 4. Deploy to Board ```bash scripts/deploy_to_board.sh --board localhost:9999 --sdk sdk/ --server server/build/ ``` ### 5. Run Tests ```bash scripts/run_tests.sh --jmx jmeter/test_plans/test.jmx --output jmeter/results/ ``` ## Key Implementation Details ### SDK Analysis Pattern ```cpp // SDK Header venc_error_t venc_get_device_info(venc_device_info_t *info); typedef struct { char device_id[64]; ... } venc_device_info_t; typedef enum { VENC_OK=0, VENC_ERR_PARAM=1001 } venc_error_t; ↓ Analysis ↓ // Proto Definition service VencService { rpc GetDeviceInfo(GetDeviceInfoRequest) returns (GetDeviceInfoResponse); } message GetDeviceInfoResponse { string device_id = 1; ErrorCode error = 2; } ``` ### Server Wrapper Pattern ```cpp // gRPC Server wraps SDK calls Status GetDeviceInfo(ServerContext* ctx, const GetDeviceInfoRequest* req, GetDeviceInfoResponse* resp) override { venc_device_info_t info; venc_error_t err = venc_get_device_info(&info); // Call SDK if (err == VENC_OK) { resp->set_device_id(info.device_id); return Status::OK; } return Status(StatusCode::INTERNAL, "SDK error"); } ``` ### Serial Communication Protocol ```json // Commands {"command": "MOUNT", "source_path": "/path/to/sdk"} {"command": "UPLOAD", "filename": "grpc_server", "content": "..."} {"command": "START_SERVER", "port": 8080} {"command": "STATUS"} {"command": "STOP_SERVER"} ``` ## See Also - `references/sdk-analysis.md` - SDK header parsing patterns - `references/cpp-server.md` - C++ gRPC server implementation - `references/serial-protocol.md` - Serial communication details - `references/jmeter-config.md` - JMeter gRPC plugin configuration

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 grpc-test-automation-1775933795 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 grpc-test-automation-1775933795 技能

通过命令行安装

skillhub install grpc-test-automation-1775933795

下载 Zip 包

⬇ 下载 grpc-test-automation v1.0.0

文件大小: 24.59 KB | 发布时间: 2026-4-12 10:09

v1.0.0 最新 2026-4-12 10:09
Initial release of grpc-test-automation.

- Provides a full gRPC test automation framework for C/C++ SDKs on embedded devices.
- Automatically analyzes SDK headers, generates gRPC interfaces, and wraps SDK calls with a C++ gRPC server.
- Integrates with JMeter to create and run test plans using generated proto descriptors.
- Simulates serial communication for resource deployment and service control on the embedded board.
- Generates Excel-format test reports summarizing test results, performance metrics, and errors.
- Includes scripts for each step: analysis, server generation, build, deployment, test execution, and reporting.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部