syntax = "proto3"; package test_pb; option go_package = "Beacon/server/gen/pb"; // 替换 your_module_path // Python 生成时,会在 proto_gen 目录下直接生成 common_test_pb2.py, // Python 代码中 import proto_gen.common_test_pb2 即可。 // -------- 输入消息 -------- // 整个测试任务的输入 message TestRunInput { string run_id = 1; // 唯一的测试运行ID string environment_url = 2; // 被测环境URL repeated string tags = 3; // 测试标签,例如 "smoke", "regression" bool run_api_tests = 4; bool run_ui_tests = 5; } // 单个API测试请求的参数 message ApiTestRequest { string test_case_id = 1; // API测试用例ID string endpoint = 2; // API路径 string http_method = 3; // "GET", "POST", etc. map headers = 4; bytes request_body = 5; // JSON或其他二进制数据 int32 expected_status_code = 6; } // 单个UI测试请求的参数 message UiTestRequest { string test_case_id = 1; // UI测试用例ID string url_path = 2; // 相对于 base_url 的路径 string browser_type = 3; // "chromium", "firefox", "webkit" bool headless = 4; // 是否无头模式 map user_data = 5; // 用户名、密码等敏感信息,不建议直接传输,建议 Worker 端获取 } // -------- 结果消息 -------- // 通用测试结果字段 message BaseTestResult { string test_case_id = 1; bool success = 2; string message = 3; // 成功/失败信息 string log_output = 4; // 详细日志 double duration_seconds = 5; string error_details = 6; // 失败时的详细错误堆栈 } // API测试结果 message ApiTestResult { BaseTestResult base_result = 1; int32 actual_status_code = 2; string response_body = 3; } // UI测试结果 message UiTestResult { BaseTestResult base_result = 1; string screenshot_url = 2; // 截图存储URL (worker上传后返回) string html_report_url = 3; // HTML报告URL } // 整个测试任务的输出结果 message TestRunOutput { string run_id = 1; bool overall_success = 2; string completion_message = 3; repeated ApiTestResult api_results = 4; repeated UiTestResult ui_results = 5; }