项目背景
随着集团内网大模型的部署完成,我们探索了AI技术在软件测试领域的创新应用场景。通过对接禅道系统API,实现了从需求到测试用例的全流程智能化生成,显著提升了测试效率。

技术架构设计
核心思路
- 需求获取:直接调用禅道OpenAPI获取原始需求文档
- 智能转换:利用大模型解析需求文本,生成结构化测试用例
- 闭环验证:将生成的用例回写至禅道系统,形成完整测试闭环
实践步骤详解
一、禅道API插件开发

填写yaml或json格式的API信息
openapi: 3.0.1
info:
title: 个人项目
description: 禅道系统 登录
version: 1.0.0
tags:
- name: 禅道系统
servers:
- url: http://youDomain/zentao/api.php/v1/
paths:
/tokens:
post:
summary: 获取TOKEN
deprecated: false
description: 登录系统以获取认证令牌
tags:
- 禅道系统
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/LoginRequest'
examples:
example2:
summary: 示例 2
value:
account:
password:
example3:
summary: 示例 3
value:
account:
password:
responses:
'201':
description: 令牌创建成功
content:
application/json:
schema:
$ref: '#/components/schemas/LoginResponse'
examples:
success:
summary: 成功示例
value:
token: "9dd7c02de078d8440f819299d44df983"
failure:
summary: 异常示例
value:
error: 登录失败,请检查您的用户名或密码是否填写正确。
'400':
description: 参数不正确
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
invalid_request:
summary: 参数不正确示例
value:
error: 参数不正确
x-400-parameter-incorrect:
description: 参数不正确
content:
application/json:
schema:
$ref: '#/components/schemas/ErrorDetail'
examples:
parameter_error:
summary: 参数错误示例
value:
code: 400
message: 参数不正确
security: []
components:
schemas:
LoginRequest:
type: object
required:
- account
- password
properties:
account:
type: string
description: 用户名
password:
type: string
description: 密码
LoginResponse:
type: object
properties:
token:
type: string
description: 认证令牌
Error:
type: object
required:
- error
properties:
error:
type: string
description: 错误信息
ErrorDetail:
type: object
required:
- code
- message
properties:
code:
type: integer
description: 错误代码
message:
type: string
description: 错误信息
2,智能化工作流设计

开始→条件分支→LLM产品ID→禅道插件→禅道接口需求→LLM3-创建用例→LLM整理用户→向禅道写入用例
关键技术实现
HTTP 用户向禅道创建用例

应用价值
- 效率提升:用例生成效率提升80%以上
- 覆盖率增强:通过AI组合测试场景,覆盖率达95%+
- 成本节约:减少70%的手工编写工作量
后续优化方向
- 增加用例评审自动触发机制
- 构建测试用例知识库
- 实现缺陷预测功能扩展

