1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806
| app: description: AI接口用例设计智能体 icon: 🤖 icon_background: '#FFEAD5' icon_type: emoji mode: workflow name: Day05-04-AI接口用例设计智能体 use_icon_as_answer_icon: false dependencies: - current_identifier: null type: marketplace value: marketplace_plugin_unique_identifier: langgenius/openai:0.3.5@dcc15b5847dbe38c64c2a9fdc1ea2d46466b7028eb4766b251bc363b0eec3af3 version: null kind: app version: 0.6.0 workflow: conversation_variables: [] environment_variables: [] features: file_upload: allowed_file_extensions: - .JPG - .JPEG - .PNG - .GIF - .WEBP - .SVG allowed_file_types: - image allowed_file_upload_methods: - local_file - remote_url enabled: false fileUploadConfig: attachment_image_file_size_limit: 2 audio_file_size_limit: 50 batch_count_limit: 5 file_size_limit: 15 file_upload_limit: 20 image_file_batch_limit: 10 image_file_size_limit: 10 single_chunk_attachment_limit: 10 video_file_size_limit: 100 workflow_file_upload_limit: 10 image: enabled: false number_limits: 3 transfer_methods: - local_file - remote_url number_limits: 3 opening_statement: '' retriever_resource: enabled: true sensitive_word_avoidance: enabled: false speech_to_text: enabled: false suggested_questions: [] suggested_questions_after_answer: enabled: false text_to_speech: enabled: false language: '' voice: '' graph: edges: - data: isInIteration: false isInLoop: false sourceType: start targetType: llm id: 1776955606827-source-1776956083764-target source: '1776955606827' sourceHandle: source target: '1776956083764' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: llm targetType: llm id: 1776956083764-source-1776956373124-target source: '1776956083764' sourceHandle: source target: '1776956373124' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: llm targetType: if-else id: 1776956083764-source-1776956939229-target source: '1776956083764' sourceHandle: source target: '1776956939229' targetHandle: target type: custom zIndex: 0 - data: isInLoop: false sourceType: if-else targetType: llm id: 1776956939229-true-1776956424552-target source: '1776956939229' sourceHandle: 'true' target: '1776956424552' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: llm targetType: if-else id: 1776956083764-source-1776956991653-target source: '1776956083764' sourceHandle: source target: '1776956991653' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: if-else targetType: llm id: 1776956991653-true-1776957066084-target source: '1776956991653' sourceHandle: 'true' target: '1776957066084' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: if-else targetType: llm id: 1776956939229-true-1776957114997-target source: '1776956939229' sourceHandle: 'true' target: '1776957114997' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: llm targetType: llm id: 1777013409175-source-1777013715727-target source: '1777013409175' sourceHandle: source target: '1777013715727' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: llm targetType: end id: 1777013715727-source-1777014117960-target source: '1777013715727' sourceHandle: source target: '1777014117960' targetHandle: target type: custom zIndex: 0 - data: isInIteration: false isInLoop: false sourceType: llm targetType: template-transform id: 1776956424552-source-1777020413553-target source: '1776956424552' sourceHandle: source target: '1777020413553' targetHandle: target type: custom zIndex: 0 - data: isInLoop: false sourceType: llm targetType: template-transform id: 1776957114997-source-1777020413553-target source: '1776957114997' sourceHandle: source target: '1777020413553' targetHandle: target type: custom zIndex: 0 - data: isInLoop: false sourceType: llm targetType: template-transform id: 1776957066084-source-1777020413553-target source: '1776957066084' sourceHandle: source target: '1777020413553' targetHandle: target type: custom zIndex: 0 - data: isInLoop: false sourceType: llm targetType: template-transform id: 1776956373124-source-1777020413553-target source: '1776956373124' sourceHandle: source target: '1777020413553' targetHandle: target type: custom zIndex: 0 - data: isInLoop: false sourceType: template-transform targetType: llm id: 1777020413553-source-1777013409175-target source: '1777020413553' sourceHandle: source target: '1777013409175' targetHandle: target type: custom zIndex: 0 nodes: - data: selected: false title: 用户输入 type: start variables: - default: basic hint: '' label: 覆盖等级 options: - basic - standard - comprehensive placeholder: '' required: true type: select variable: coverage_level - allowed_file_extensions: [] allowed_file_types: - document allowed_file_upload_methods: - local_file default: '' hint: '' label: 详细的接口信息 max_length: 3000 options: [] placeholder: '' required: true type: paragraph variable: api_input height: 134 id: '1776955606827' position: x: 92 y: 77 positionAbsolute: x: 92 y: 77 selected: false sourcePosition: right targetPosition: left type: custom width: 242 - data: context: enabled: false variable_selector: [] model: completion_params: temperature: 0.7 mode: chat name: gpt-5.4 provider: langgenius/openai/openai prompt_template: - id: 41c8d093-9770-434b-a3b1-1713d5d8dd2c role: system text: "# 角色\n你是一位 API 接口文档解析专家,能够将自然语言描述的接口信息精准转化为结构化的 JSON 格式。\n\n# 任务\n\ 将用户输入的自然语言接口描述,解析为标准化的接口元数据 JSON。\n\n# 用户输入\n{{#1776955606827.api_input#}}\n\ \n# 输出要求\n1. 严格输出 JSON 对象,不要包含任何其他文字、注释或 markdown 标记\n2. 字段说明:\n\n -\ \ method: HTTP方法,从描述中提取(GET/POST/PUT/DELETE/PATCH)\n - endpoint: 接口路径,从描述中提取(如\ \ /api/login)\n - summary: 用一句话概括接口功能(如\"用户登录\")\n - parameters: 参数数组,每个参数包含:\n\ \ * name: 参数名\n * in: 参数位置,固定为 \"body\"(因为用户描述的是请求体参数)\n *\ \ type: 数据类型(string/integer/number/boolean/array/object)\n * required:\ \ 布尔值,描述中出现\"必填\"则为 true,\"可选\"则为 false\n * constraints: 约束描述,从用户原文中提取(如\"\ 长度3-20\"),没有则为空字符串 \"\"\n * description: 参数用途的简短描述,根据参数名语义推断\n -\ \ auth_required: 是否需要认证,默认 true(大多数接口需要)\n - response_codes: 预期可能的响应状态码数组\n\ \n3. 参数解析规则:\n - 从用户描述中识别参数格式:参数名(类型 必填/可选, 约束)\n - 类型映射:字符串→string,\ \ 整数→integer, 浮点数→number, 布尔→boolean, 数组→array, 对象→object\n - 如果用户没有写约束条件,constraints\ \ 设为 \"\"\n - 如果用户没有明确标注必填/可选,默认 required 为 true\n\n4. response_codes\ \ 推断规则(根据 method 和接口语义推断):\n - 总是包含:200(成功), 400(参数错误), 401(未认证), 500(服务器错误)\n\ \ - 如果是 GET 请求,额外包含 404(资源不存在)\n - 如果是 POST 请求且语义是创建类操作,额外包含 201(创建成功),\ \ 409(冲突)\n\n5. summary 推断规则:\n - 从 endpoint 路径推断(如 /api/login → \"\ 用户登录\",/api/users → \"用户列表\")\n - 如果路径含数字ID(如 /api/users/:id),说明是针对单个资源的操作\n\ \n# 输出示例\n\n用户输入:POST /api/login,参数:username(字符串必填), password(字符串必填)\n\ \n输出:\n{\n \"method\": \"POST\",\n \"endpoint\": \"/api/login\",\n \ \ \"summary\": \"用户登录\",\n \"parameters\": [\n {\n \"name\":\ \ \"username\",\n \"in\": \"body\",\n \"type\": \"string\",\n\ \ \"required\": true,\n \"constraints\": \"\",\n \"description\"\ : \"用户名\"\n },\n {\n \"name\": \"password\",\n \"in\"\ : \"body\",\n \"type\": \"string\",\n \"required\": true,\n\ \ \"constraints\": \"\",\n \"description\": \"密码\"\n }\n\ \ ],\n \"auth_required\": true,\n \"response_codes\": [200, 400, 401,\ \ 500]\n}\n\n用户输入:GET /api/users/:id,参数:id(整数必填)\n\n输出:\n{\n \"method\"\ : \"GET\",\n \"endpoint\": \"/api/users/:id\",\n \"summary\": \"获取用户详情\"\ ,\n \"parameters\": [\n {\n \"name\": \"id\",\n \"in\":\ \ \"path\",\n \"type\": \"integer\",\n \"required\": true,\n\ \ \"constraints\": \"\",\n \"description\": \"用户ID\"\n }\n\ \ ],\n \"auth_required\": true,\n \"response_codes\": [200, 400, 401,\ \ 404, 500]\n}\n\n用户输入:POST /api/goods,参数:name(字符串必填, 长度2-50), price(数字必填,\ \ 大于0), category_id(整数可选)\n\n输出:\n{\n \"method\": \"POST\",\n \"endpoint\"\ : \"/api/goods\",\n \"summary\": \"创建商品\",\n \"parameters\": [\n \ \ {\n \"name\": \"name\",\n \"in\": \"body\",\n \"type\"\ : \"string\",\n \"required\": true,\n \"constraints\": \"长度2-50\"\ ,\n \"description\": \"商品名称\"\n },\n {\n \"name\": \"\ price\",\n \"in\": \"body\",\n \"type\": \"number\",\n \ \ \"required\": true,\n \"constraints\": \"大于0\",\n \"description\"\ : \"商品价格\"\n },\n {\n \"name\": \"category_id\",\n \"\ in\": \"body\",\n \"type\": \"integer\",\n \"required\": false,\n\ \ \"constraints\": \"\",\n \"description\": \"商品分类ID\"\n \ \ }\n ],\n \"auth_required\": true,\n \"response_codes\": [200, 400,\ \ 401, 409, 500]\n}\n\n# 现在请解析以下用户输入:\n{{#1776955606827.api_input#}}" selected: true title: 解析接口定义 type: llm vision: enabled: false height: 87 id: '1776956083764' position: x: 92 y: 228 positionAbsolute: x: 92 y: 228 selected: true sourcePosition: right targetPosition: left type: custom width: 241 - data: context: enabled: false variable_selector: [] model: completion_params: temperature: 0.7 mode: chat name: gpt-5.4 provider: langgenius/openai/openai prompt_template: - id: 19ca9d97-40be-40ae-9a60-6967ac7a9d51 role: system text: "# 角色\n你是一位资深测试工程师,擅长 REST API 接口测试用例设计。\n\n# 任务\n根据接口定义,设计【正向测试用例】。\n\ \n# 接口定义\n{{#1776955606827.api_input#}}\n\n# 覆盖级别\n{{coverage_level}}\n\ - basic: 只设计核心正常流程,每个必填参数1个有效值即可\n- standard: 正常流程 + 可选参数的有/无组合 + 多种合法值\n\ - comprehensive: 全部正向场景,含多角色、多状态、多种合法值覆盖\n\n# 要求\n1. 每条用例必须包含字段:case_id,\ \ title, priority(P0/P1/P2), type(\"正向\"), category(\"功能验证\"), preconditions,\ \ method, endpoint, headers, request_body, expected_status, expected_response\n\ 1. case_id 格式:POS_001, POS_002, POS_003... 递增编号\n3. priority 规则:\n -\ \ P0: 核心主流程(必跑)\n - P1: 重要功能路径\n - P2: 辅助功能路径\n4. preconditions 描述前置条件(如:用户已注册、用户已登录、数据库存在测试数据等)\n\ 2. expected_response 描述关键字段校验,不要写完整 JSON,用 \"应返回xxx字段,值为xxx\" 的格式\n6.\ \ headers 中必须包含 Content-Type\n7. request_body 的值必须是具体的测试数据,不能用占位符\n\n\ # 输出格式\n严格输出 JSON 数组,不要包含任何其他文字:\n[\n {\n \"case_id\": \"POS_001\"\ ,\n \"title\": \"正常登录-有效用户名和密码\",\n \"priority\": \"P0\",\n \"\ type\": \"正向\",\n \"category\": \"功能验证\",\n \"preconditions\": \"\ 用户已注册且未被封禁\",\n \"method\": \"POST\",\n \"endpoint\": \"/api/login\"\ ,\n \"headers\": {\"Content-Type\": \"application/json\"},\n \"\ request_body\": {\"username\": \"testuser01\", \"password\": \"Test@1234\"\ },\n \"expected_status\": 200,\n \"expected_response\": \"应返回token字段,值不为空;应返回code字段,值为0\"\ \n }\n]" selected: false title: 正向用例生成 type: llm vision: enabled: false height: 87 id: '1776956373124' position: x: -77 y: 345 positionAbsolute: x: -77 y: 345 selected: false sourcePosition: right targetPosition: left type: custom width: 241 - data: context: enabled: false variable_selector: [] model: completion_params: temperature: 0.7 mode: chat name: gpt-5.4 provider: langgenius/openai/openai prompt_template: - id: 0b5fafca-baa1-45e4-a06b-0057b8cca0b9 role: system text: "# 角色\n你是一位资深测试工程师,专注于 API 接口的异常场景测试。\n\n# 任务\n根据接口定义,设计【参数校验类负向测试用例】。\n\ \n# 接口定义\n{{#1776955606827.api_input#}}\n\n# 覆盖级别\n{{#1776955606827.coverage_level#}}\n\ - standard: 必填缺失、空值/null、类型错误、格式不合法\n- comprehensive: 在standard基础上增加:未定义字段注入、多余参数、JSON格式错误\n\ \n# 要求\n1. 每条用例必须包含字段:case_id, title, priority(P0/P1/P2), type(\"负向\"\ ), category(\"参数校验\"), defect_type, preconditions, method, endpoint, headers,\ \ request_body, expected_status, expected_response\n2. case_id 格式:NEG_PARAM_001,\ \ NEG_PARAM_002... 递增编号\n3. defect_type 枚举值:必填缺失 | 空值 | 类型错误 | 格式非法 |\ \ 未定义字段 | 多余参数 | JSON格式错误\n4. 对每个参数,至少覆盖以下场景(根据 coverage_level):\n -\ \ 必填参数缺失(整个字段不传)\n - 传空字符串 \"\"\n - 传 null\n - 类型错误(字符串参数传数字、数字参数传字符串、数组传单个值)\n\ \ - 格式非法(邮箱缺@、手机号非11位、日期格式错误等)\n5. 每条用例只改变一个参数,其他参数保持合法值\n6. priority\ \ 规则:P0=必填缺失, P1=类型错误/格式非法, P2=其他\n7. preconditions 描述前置条件\n8. expected_response\ \ 描述期望的错误提示信息格式,如 \"应返回错误码,提示xxx不能为空\"\n\n# 输出格式\n严格输出 JSON 数组,不要包含任何其他文字:\n\ [\n {\n \"case_id\": \"NEG_PARAM_001\",\n \"title\": \"参数校验-缺少必填参数username\"\ ,\n \"priority\": \"P0\",\n \"type\": \"负向\",\n \"category\"\ : \"参数校验\",\n \"defect_type\": \"必填缺失\",\n \"preconditions\": \"\ 无特殊前置条件\",\n \"method\": \"POST\",\n \"endpoint\": \"/api/login\"\ ,\n \"headers\": {\"Content-Type\": \"application/json\"},\n \"\ request_body\": {\"password\": \"Test@1234\"},\n \"expected_status\"\ : 400,\n \"expected_response\": \"应返回错误信息,提示username不能为空\"\n }\n]" selected: false title: 参数校验负向 type: llm vision: enabled: false height: 87 id: '1776956424552' position: x: 14.9632 y: 493 positionAbsolute: x: 14.9632 y: 493 selected: false sourcePosition: right targetPosition: left type: custom width: 241 - data: cases: - case_id: 'true' conditions: - comparison_operator: is not id: 86d34694-feb9-41d8-a75f-d25b950904dc value: basic varType: string variable_selector: - '1776955606827' - coverage_level id: 'true' logical_operator: and selected: false title: 条件分支 type: if-else height: 147 id: '1776956939229' position: x: 186 y: 329 positionAbsolute: x: 186 y: 329 selected: false sourcePosition: right targetPosition: left type: custom width: 241 - data: cases: - case_id: 'true' conditions: - comparison_operator: is id: cad48e98-b477-401f-b9b5-c1693eb01752 value: comprehensive varType: string variable_selector: - '1776955606827' - coverage_level id: 'true' logical_operator: and selected: false title: 条件分支 2 type: if-else height: 147 id: '1776956991653' position: x: 451 y: 329 positionAbsolute: x: 451 y: 329 selected: false sourcePosition: right targetPosition: left type: custom width: 241 - data: context: enabled: false variable_selector: [] model: completion_params: temperature: 0.7 mode: chat name: gpt-5.4 provider: langgenius/openai/openai prompt_template: - id: 679c31f9-038d-42c4-a832-3b452919cf50 role: system text: "# 角色\n你是一位资深测试工程师,擅长发现业务逻辑层面的接口缺陷。\n\n# 任务\n根据接口定义,设计【业务逻辑类负向测试用例】。\n\ \n# 接口定义\n{{#1776955606827.api_input#}}\n\n# 要求\n1. 每条用例必须包含字段:case_id,\ \ title, priority(P0/P1/P2), type(\"负向\"), category(\"业务逻辑\"), defect_type,\ \ preconditions, method, endpoint, headers, request_body, expected_status,\ \ expected_response\n2. case_id 格式:NEG_BL_001, NEG_BL_002... 递增编号\n3.\ \ defect_type 枚举值:权限不足 | 数据不存在 | 重复操作 | 状态冲突 | 并发冲突 | 越权访问 | 数据一致性 | 时序依赖\n\ 1. 从以下维度逐一设计用例(每个维度至少1条):\n\n a) 权限不足\n - 未登录/未授权访问需认证的接口\n \ \ - 普通用户访问管理员接口\n - Token 过期或无效\n\n b) 数据不存在\n - 查询/修改/删除不存在的资源ID\n\ \ - 关联数据不存在(如订单关联的商品已下架)\n\n c) 重复操作\n - 重复提交(相同参数连续请求2次)\n\ \ - 幂等性校验(PUT/DELETE 重复调用)\n\n d) 状态冲突\n - 对已完成订单执行取消操作\n\ \ - 对已删除数据执行修改\n - 对已审核通过的内容再次提交审核\n\n e) 并发冲突\n - 两个用户同时修改同一条数据\n\ \ - 库存扣减超卖场景\n\n f) 越权访问(水平越权/垂直越权)\n - 用户A操作用户B的数据(通过修改ID参数)\n\ \n g) 数据一致性\n - 创建订单后库存未扣减\n - 退款后余额未恢复\n\n h) 时序依赖\n \ \ - 未完成上一步直接执行下一步\n - 在依赖资源创建前引用该资源\n\n5. preconditions 必须详细描述前置数据准备(如\"\ 已存在用户ID=1001,余额=100元\")\n6. request_body 中的值必须是具体的、可执行的数据\n7. priority\ \ 规则:P0=越权访问/并发冲突, P1=权限不足/数据不存在/状态冲突, P2=其他\n\n# 输出格式\n严格输出 JSON 数组,不要包含任何其他文字:\n\ [\n {\n \"case_id\": \"NEG_BL_001\",\n \"title\": \"业务逻辑-未登录访问需认证接口\"\ ,\n \"priority\": \"P1\",\n \"type\": \"负向\",\n \"category\"\ : \"业务逻辑\",\n \"defect_type\": \"权限不足\",\n \"preconditions\": \"\ 用户未获取有效Token\",\n \"method\": \"POST\",\n \"endpoint\": \"/api/login\"\ ,\n \"headers\": {\"Content-Type\": \"application/json\"},\n \"\ request_body\": {\"username\": \"testuser01\", \"password\": \"Test@1234\"\ },\n \"expected_status\": 401,\n \"expected_response\": \"应返回401错误码,提示未授权或未登录\"\ \n }\n]" selected: false title: 业务逻辑负向 type: llm vision: enabled: false height: 87 id: '1776957066084' position: x: 543 y: 493 positionAbsolute: x: 543 y: 493 selected: false sourcePosition: right targetPosition: left type: custom width: 241 - data: context: enabled: false variable_selector: [] model: completion_params: temperature: 0.7 mode: chat name: gpt-5.4 provider: langgenius/openai/openai prompt_template: - id: c0d9e193-2835-4679-9fb4-a7051277675a role: system text: "# 角色\n你是一位资深测试工程师,擅长通过边界值分析发现接口缺陷。\n\n# 任务\n根据接口定义,设计【边界值类负向测试用例】。\n\ \n# 接口定义\n{{#1776955606827.api_input#}}\n\n# 覆盖级别\n{{#1776955606827.coverage_level#}}\n\ - standard: 最小值-1, 最小值, 最大值, 最大值+1, 空字符串, 空格字符串\n- comprehensive: 在standard基础上增加:超长字符串(1000字符)、特殊字符、Unicode字符、前后空格、零值(数值0)、负数(仅数值类型)\n\ \n# 要求\n1. 每条用例必须包含字段:case_id, title, priority(P1/P2), type(\"负向\"), category(\"\ 边界值\"), boundary_point, test_value, preconditions, method, endpoint, headers,\ \ request_body, expected_status, expected_response\n2. case_id 格式:NEG_BV_001,\ \ NEG_BV_002... 递增编号\n3. boundary_point 枚举值:最小值-1 | 最小值 | 最大值 | 最大值+1\ \ | 空字符串 | 空格 | 超长 | 特殊字符 | Unicode | 零值 | 负数\n4. test_value 是实际传入的测试值,方便阅读\n\ 1. 对每个字符串参数,至少覆盖:最小长度-1, 最小长度, 最大长度, 最大长度+1, 空串, 空格串\n6. 对每个数值参数,至少覆盖:下限-1,\ \ 下限, 上限, 上限+1, 0\n7. 如果参数有枚举约束,覆盖:枚举外的值、空值\n8. 每条用例只改变一个参数的值,其他参数保持合法值\n\ 2. preconditions 描述前置条件\n10. expected_response 描述期望的错误信息或边界处理行为\n\n# 输出格式\n\ 严格输出 JSON 数组,不要包含任何其他文字:\n[\n {\n \"case_id\": \"NEG_BV_001\",\n \ \ \"title\": \"边界值-username长度为最小值-1(2个字符)\",\n \"priority\": \"P1\"\ ,\n \"type\": \"负向\",\n \"category\": \"边界值\",\n \"boundary_point\"\ : \"最小值-1\",\n \"test_value\": \"ab\",\n \"preconditions\": \"无特殊前置条件\"\ ,\n \"method\": \"POST\",\n \"endpoint\": \"/api/login\",\n \"\ headers\": {\"Content-Type\": \"application/json\"},\n \"request_body\"\ : {\"username\": \"ab\", \"password\": \"Test@1234\"},\n \"expected_status\"\ : 400,\n \"expected_response\": \"应返回错误信息,提示username长度不能少于3个字符\"\n\ \ }\n]" selected: false title: 边界值负向 type: llm vision: enabled: false height: 87 id: '1776957114997' position: x: 280 y: 493 positionAbsolute: x: 280 y: 493 selected: false sourcePosition: right targetPosition: left type: custom width: 241 - data: context: enabled: false variable_selector: [] model: completion_params: temperature: 0.7 mode: chat name: gpt-5.4 provider: langgenius/openai/openai prompt_template: - id: 902a70ae-3180-45c8-8171-f9a35a8e5752 role: system text: "# 角色\n你是一位资深测试工程师,负责对多个来源的测试用例进行汇总、去重和质量审查。\n\n# 任务\n将以下来自不同生成节点的测试用例合并成一份完整、无冗余的测试用例集,并输出汇总统计信息。\n\ \n# 输入数据\n{{#1777020413553.output#}}\n\n# 去重规则(按优先级依次执行)\n\n## 规则1:完全重复\n\ - 如果两条用例的 method + endpoint + request_body 完全相同,保留优先级更高的那条(P0>P1>P2)\n\ - 优先级相同时,保留正向用例,删除负向用例\n\n## 规则2:语义重复\n- 如果两条用例测试目的相同(如\"缺少username参数\"\ 出现了2次),只保留描述更详细、preconditions 更完整的那条\n- 判断标准:title 语义相近 + category 相同\ \ + request_body 结构相同\n\n## 规则3:参数组合与负向重叠\n- 如果参数组合用例中某条与参数校验负向/边界值负向的用例\ \ request_body 完全相同,删除参数组合中的那条(保留有明确 defect_type 标注的用例)\n\n# 质量检查规则(去重后执行)\n\ \n对保留的每条用例逐一检查:\n1. case_id 是否唯一 — 如有重复,按 类型缩写_序号 格式重新编号\n2. expected_status\ \ 是否合理 — 正向用例必须是 2xx,负向用例必须是 4xx 或 5xx\n3. request_body 是否有占位符(如 \"xxx\"\ 、\"test\"、\"valid_xxx\")— 如有,替换为符合业务语义的具体值\n4. preconditions 是否为空 — 如果为空,根据接口语义补充合理的前置条件\n\ \n# 编号规范(重新统一编号)\n\n去重后按以下规则对所有用例重新编号:\n- 正向用例:POS_001, POS_002...\n-\ \ 参数校验负向:NEG_PARAM_001, NEG_PARAM_002...\n- 边界值负向:NEG_BV_001, NEG_BV_002...\n\ - 业务逻辑负向:NEG_BL_001, NEG_BL_002...\n- 参数组合:COMBO_001, COMBO_002...\n\n\ 编号顺序:先按 category 分组,组内按 priority 升序排列(P0 在前)。\n\n# 输出格式\n\n严格输出以下 JSON\ \ 结构,不要包含任何其他文字:\n\n{\n \"summary\": {\n \"total\": 总用例数,\n \"\ positive\": 正向用例数,\n \"negative\": {\n \"param_validation\": 参数校验用例数,\n\ \ \"boundary_value\": 边界值用例数,\n \"business_logic\": 业务逻辑用例数\n\ \ },\n \"combination\": 参数组合用例数,\n \"removed_duplicates\": 去重删除的条数,\n\ \ \"p0_count\": P0用例总数,\n \"p1_count\": P1用例总数,\n \"p2_count\"\ : P2用例总数\n },\n \"quality_issues\": [\n {\n \"case_id\": \"\ 发现问题的用例ID\",\n \"issue\": \"问题描述\",\n \"action\": \"已执行的修正动作\"\ \n }\n ],\n \"cases\": [\n 完整的用例对象数组,包含所有字段\n ]\n}\n\n# 输出示例(仅展示结构,实际内容根据输入动态生成)\n\ \n{\n \"summary\": {\n \"total\": 35,\n \"positive\": 5,\n \"\ negative\": {\n \"param_validation\": 12,\n \"boundary_value\"\ : 10,\n \"business_logic\": 6\n },\n \"combination\": 2,\n\ \ \"removed_duplicates\": 3,\n \"p0_count\": 8,\n \"p1_count\"\ : 18,\n \"p2_count\": 9\n },\n \"quality_issues\": [\n {\n \ \ \"case_id\": \"NEG_PARAM_003\",\n \"issue\": \"request_body 中\ \ username 值为占位符 'valid_username'\",\n \"action\": \"已替换为具体值 'testuser01'\"\ \n },\n {\n \"case_id\": \"NEG_BV_007\",\n \"issue\":\ \ \"preconditions 为空\",\n \"action\": \"已补充:用户未登录,接口无鉴权前置要求\"\n \ \ }\n ],\n \"cases\": [\n {\n \"case_id\": \"POS_001\",\n\ \ \"title\": \"正常登录-有效用户名和密码\",\n \"priority\": \"P0\",\n \ \ \"type\": \"正向\",\n \"category\": \"功能验证\",\n \"preconditions\"\ : \"用户已注册且未被封禁\",\n \"method\": \"POST\",\n \"endpoint\": \"\ /api/login\",\n \"headers\": {\"Content-Type\": \"application/json\"\ },\n \"request_body\": {\"username\": \"testuser01\", \"password\"\ : \"Test@1234\"},\n \"expected_status\": 200,\n \"expected_response\"\ : \"应返回token字段,值不为空;应返回code字段,值为0\"\n }\n ]\n}" selected: false title: 用例汇总去重 type: llm vision: enabled: false height: 87 id: '1777013409175' position: x: -83.30080000000001 y: 688.5712 positionAbsolute: x: -83.30080000000001 y: 688.5712 selected: false sourcePosition: right targetPosition: left type: custom width: 241 - data: context: enabled: false variable_selector: [] desc: JSON 转成 Markdown 表格 model: completion_params: temperature: 0.7 mode: chat name: gpt-5.4 provider: langgenius/openai/openai prompt_template: - id: a240643d-8150-4c30-a0f1-5687c1b1447b role: system text: '# 任务
将以下测试用例 JSON 转换为清晰的 Markdown 表格报告。
# 输入数据
{{#1777013409175.text#}}
# 输出要求
1. 第一部分:统计摘要表格(总数/正向/各类负向/P0/P1/P2 数量)
2. 第二部分:测试用例明细,按 category 分组,每组一个独立表格
3. 表格列:用例ID | 优先级 | 标题 | 前置条件 | 请求方法 | 请求路径 | 请求体 | 期望状态码 | 期望响应
4. 组内按 priority 升序排列(P0 在前)
5. 严格输出 Markdown 文本,不要输出 JSON,不要加代码块标记' selected: false title: 格式化输出 type: llm vision: enabled: false height: 115 id: '1777013715727' position: x: 186 y: 688.5712 positionAbsolute: x: 186 y: 688.5712 selected: false sourcePosition: right targetPosition: left type: custom width: 241 - data: outputs: - value_selector: - '1777013715727' - text value_type: string variable: text selected: false title: 输出 type: end height: 87 id: '1777014117960' position: x: 476.65599999999995 y: 688.5712 positionAbsolute: x: 476.65599999999995 y: 688.5712 selected: false sourcePosition: right targetPosition: left type: custom width: 241 - data: selected: false template: "{% if arg1 %}## 正向用例\r\n{{ arg1 }}\r\n{% endif %}{% if arg2 %}##\ \ 参数校验负向用例\r\n{{ arg2 }}\r\n{% endif %}{% if arg3 %}## 边界值负向用例\r\n{{ arg3\ \ }}\r\n{% endif %}{% if arg4 %}## 业务逻辑负向用例\r\n{{ arg4 }}\r\n{% endif %}" title: 模板转换 type: template-transform variables: - value_selector: - '1776956373124' - text value_type: string variable: arg1 - value_selector: - '1776956424552' - text value_type: string variable: arg2 - value_selector: - '1776957114997' - text value_type: string variable: arg3 - value_selector: - '1776957066084' - text value_type: string variable: arg4 height: 51 id: '1777020413553' position: x: -25 y: 616.264 positionAbsolute: x: -25 y: 616.264 selected: false sourcePosition: right targetPosition: left type: custom width: 241 viewport: x: 112.05709876543193 y: -81.56944444444457 zoom: 0.9645061728395065 rag_pipeline_variables: []
|