Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateGroupsForRequirements(ctx context.Context, requirements []*apistructs.Issue, openaiURL *url.URL, ...) (requirementIdToGroups map[uint64][]string, err error)
- func New(ctx context.Context, prompt string, background *pb.Background) functions.Function
- type AICreateTestCasesResult
- type Function
- func (f *Function) Callback(ctx context.Context, arguments json.RawMessage, input interface{}) (any, error)
- func (f *Function) CompletionOptions() []sdk.PatchOption
- func (f *Function) Description() string
- func (f *Function) Handler(ctx context.Context, factory functions.FunctionFactory, req *pb.ApplyRequest, ...) (any, error)
- func (f *Function) Name() string
- func (f *Function) RequestOptions() []sdk.RequestOption
- func (f *Function) Schema() (json.RawMessage, error)
- func (f *Function) SystemMessage(lang string) string
- func (f *Function) UserMessage() string
- type FunctionParams
- type GroupList
- type MessageByLanguage
- type RequireTestCaseIndex
- type RequirementGroup
- type SubDirs
- type TestCaseCreateRequestList
- type TestCaseFunctionInput
- type TestCaseParam
- type TestcasesDirsInfo
Constants ¶
View Source
const ( Name = "create-test-case" AIGeneratedTestSetName = "AI_Generated" AIGeneratedLevel2TestSetNamePrefix = "AI_" // OperationTypeGenerate 表示当前调用接口触发测试用例 生成 操作 OperationTypeGenerate = "Generate" // OperationTypeSave 表示当前调用接口触发测试用例 保存 操作 OperationTypeSave = "Save" I18nLang_zh_CN = "zh-CN" I18nLang_en_US = "en-US" )
Variables ¶
View Source
var GroupMessages json.RawMessage
View Source
var GroupSchema json.RawMessage
View Source
var Schema json.RawMessage
Functions ¶
Types ¶
type AICreateTestCasesResult ¶
type AICreateTestCasesResult struct { IsSaveTestCasesSave bool `json:"isTestCasesSaved,omitempty"` TestCases interface{} `json:"testcases,omitempty"` TestSetsInfo TestcasesDirsInfo `json:"testSetsInfo,omitempty"` }
AI 生成测试用例返回数据
type Function ¶
type Function struct {
// contains filtered or unexported fields
}
func (*Function) CompletionOptions ¶
func (f *Function) CompletionOptions() []sdk.PatchOption
func (*Function) Description ¶
func (*Function) RequestOptions ¶
func (f *Function) RequestOptions() []sdk.RequestOption
func (*Function) SystemMessage ¶
func (*Function) UserMessage ¶
type FunctionParams ¶
type FunctionParams struct { TestSetID uint64 `json:"testSetID,omitempty"` SystemPrompt string `json:"systemPrompt,omitempty"` Requirements []TestCaseParam `json:"requirements,omitempty"` }
FunctionParams 解析 *pb.ApplyRequest 字段 FunctionParams
type MessageByLanguage ¶
type RequireTestCaseIndex ¶
type RequireTestCaseIndex struct { RequirementIndex int // aitestcase.FunctionParams.Requirements 的 index TestCaseIndex int // aitestcase.FunctionParams.Requirements[].Reqs 的 index 列表 }
保存测试用例时,用于构建需求与测试用例的索引关联关系
type RequirementGroup ¶
type TestCaseCreateRequestList ¶
type TestCaseCreateRequestList struct {
List []apistructs.TestCaseCreateRequest `json:"list"`
}
type TestCaseFunctionInput ¶
type TestCaseFunctionInput struct { TestSetParentID uint64 // 生成的测试用例所在的测试集的父测试集 ID TestSetParentDir string // 生成的测试用例所在的测试集的父测试集 Directory TestSetID uint64 // 生成的测试用例所在的测试集测 ID IssueID uint64 // 生成的测试用例对应的需求的 ID Prompt string // 为本次生成测试用例输入的 Prompt Name string //生成的测试用例对应的按需求内容分组名称 UserId string ProjectId uint64 }
TestCaseFunctionInput 用于为单个需求生成测试用例的输入
type TestCaseParam ¶
type TestCaseParam struct { IssueID uint64 `json:"issueID,omitempty"` Prompt string `json:"prompt,omitempty"` ParentTestSetID uint64 `json:"parentTestSetID,omitempty"` // 所属测试集的 Parent 测试集 ID ParentTestSetDir string `json:"parentTestSetDir,omitempty"` // 所属测试集的 Parent 测试集 Directory Reqs []apistructs.TestCaseCreateRequest `json:"testCaseCreateReqs,omitempty"` }
type TestcasesDirsInfo ¶
type TestcasesDirsInfo struct { RootDir string `json:"rootDir"` SubDirs []SubDirs `json:"subdirs"` }
TestcasesDirsInfo 用于返回生成的测试集目录以及测试集中对应的测试用例的数量
Click to show internal directories.
Click to hide internal directories.