๐ŸŽ Get the FREE AI Skills Starter Guide โ€” Subscribe โ†’
BytesAgainBytesAgain
๐Ÿฆ€ ClawHub

grpc-test-automation

by @ventus-z

Complete gRPC test automation for embedded devices with C/C++ SDK. Input: requirements.md + SDK (C/C++ headers and libraries) Output: Test framework + JMX +...

Versionv1.0.0
Downloads353
TERMINAL
clawhub install grpc-test-automation

๐Ÿ“– About This Skill


name: grpc-test-automation description: | Complete gRPC test automation for embedded devices with C/C++ SDK. Input: requirements.md + SDK (C/C++ headers and libraries) Output: Test framework + JMX + Excel report Workflow: 1. Analyze SDK headers โ†’ Design gRPC interfaces 2. Write C++ gRPC server (wraps SDK) + Proto definition 3. Compile server โ†’ Generate proto descriptor 4. Create JMeter JMX test plan 5. Simulate serial communication โ†’ Mount resources to board 6. Board starts gRPC service 7. JMeter executes tests 8. Generate Excel report Triggers: "grpc test", "ๆฟ็ซฏๆต‹่ฏ•", "ๅ่ฎฎๆต‹่ฏ•", "SDKๆต‹่ฏ•", "ๅตŒๅ…ฅๅผๆต‹่ฏ•", "create test framework", "generate jmx", "ไธฒๅฃๆต‹่ฏ•"

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

    scripts/analyze_sdk.py sdk/include/
    

    Extracts: functions, enums, structs, error codes

    2. Generate Proto + Server

    scripts/generate_grpc_server.py --sdk sdk/ --output server/
    

    Creates: proto file, server.cpp, CMakeLists.txt

    3. Build

    cd server/build && cmake .. && make
    

    Generates: grpc_server executable, service.protobin

    4. Deploy to Board

    scripts/deploy_to_board.sh --board localhost:9999 --sdk sdk/ --server server/build/
    

    5. Run Tests

    scripts/run_tests.sh --jmx jmeter/test_plans/test.jmx --output jmeter/results/
    

    Key Implementation Details

    SDK Analysis Pattern

    // 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

    // 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

    // 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