testcase

package
v1.3.0-rc.0...-12c9840 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PipelineYmlVersion = "1.1"
	ApiTestType        = "api-test"
	ApiTestIDs         = "api_ids"
	UsecaseID          = "usecase_id"
	PipelineStageLen   = 10
)

API 返回对应的错误类型

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Service)

Option testCase 实例对象配置选项

func WithBundle

func WithBundle(bdl *bundle.Bundle) Option

WithBundle 配置 bundle

func WithDBClient

func WithDBClient(db *dao.DBClient) Option

WithDBClient 配置 db client

func WithIssueDBClient

func WithIssueDBClient(db *issuedao.DBClient) Option

func WithOrg

func WithOrg(org org.Interface) Option

func WithPipelineSvc

func WithPipelineSvc(pipelineSvc pipelinepb.PipelineServiceServer) Option

type Service

type Service struct {
	CreateTestSetFn func(apistructs.TestSetCreateRequest) (*apistructs.TestSet, error)
	// contains filtered or unexported fields
}

Service testCase 实例对象封装

func New

func New(options ...Option) *Service

New 新建 testcase service

func (*Service) BatchCleanFromRecycleBin

func (svc *Service) BatchCleanFromRecycleBin(req apistructs.TestCaseBatchCleanFromRecycleBinRequest) error

BatchCleanFromRecycleBin 从回收站彻底删除测试用例

func (*Service) BatchClearProcessingRecords

func (svc *Service) BatchClearProcessingRecords() error

func (*Service) BatchCopyTestCases

func (svc *Service) BatchCopyTestCases(req apistructs.TestCaseBatchCopyRequest) ([]uint64, error)

func (*Service) BatchCreateTestCases

func (svc *Service) BatchCreateTestCases(req apistructs.TestCaseBatchCreateRequest) ([]uint64, error)

BatchCreateTestCases 批量创建测试用例

func (*Service) BatchListAPIs

func (svc *Service) BatchListAPIs(projectID uint64, tcIDs []uint64) (map[uint64][]*apistructs.ApiTestInfo, error)

func (*Service) BatchUpdateTestCases

func (svc *Service) BatchUpdateTestCases(req apistructs.TestCaseBatchUpdateRequest) error

func (*Service) CreateAPI

func (*Service) CreateFileRecord

func (svc *Service) CreateFileRecord(req apistructs.TestFileRecordRequest) (uint64, error)

func (*Service) CreateTestCase

func (svc *Service) CreateTestCase(req apistructs.TestCaseCreateRequest) (uint64, error)

CreateTestCase 创建测试用例

func (*Service) DeleteAPI

func (svc *Service) DeleteAPI(apiID int64) error

func (*Service) DeleteRecordApiFilesByTime

func (svc *Service) DeleteRecordApiFilesByTime(t time.Time) error

func (*Service) ExecuteAPIs

func (svc *Service) ExecuteAPIs(req apistructs.ApiTestsActionRequest) (uint64, error)

ExecuteAPIs return created pipelien id

func (*Service) Export

func (svc *Service) Export(req apistructs.TestCaseExportRequest) (uint64, error)

func (*Service) ExportAIGenerated

func (svc *Service) ExportAIGenerated(req apistructs.TestCaseExportRequest) (uint64, error)

func (*Service) ExportFile

func (svc *Service) ExportFile(record *dao.TestFileRecord)

func (*Service) ExportTestCases

func (svc *Service) ExportTestCases(req *apistructs.TestCaseExportRequest, sheetName string, needQuery bool) (string, error)

needQuery 参数表示测试用例是否从数据库获取 如果是从测试用例页面导出,这里需要查表, needQuery 设置为 true 如果是从 AI 生成测试用例页面导出,则无需查表,因为生成的结果并没有存储到数据库, needQuery 设置为 false

func (*Service) GetAPI

func (svc *Service) GetAPI(apiID int64) (*apistructs.ApiTestInfo, error)

func (*Service) GetFileRecord

func (svc *Service) GetFileRecord(id uint64, locale string) (*apistructs.TestFileRecord, error)

func (*Service) GetFirstFileReady

func (svc *Service) GetFirstFileReady(actionType ...apistructs.FileActionType) (bool, *dao.TestFileRecord, error)

func (*Service) GetTestCase

func (svc *Service) GetTestCase(tcID uint64) (*apistructs.TestCase, error)

GetTestCase 获取测试用例详情

func (*Service) Import

Import 导入测试用例

func (*Service) ImportFile

func (svc *Service) ImportFile(record *dao.TestFileRecord)

func (*Service) ImportTestCases

func (svc *Service) ImportTestCases(req *apistructs.TestCaseImportRequest, testFileUUID string) error

func (*Service) ListAPIs

func (svc *Service) ListAPIs(testCaseID int64) ([]*apistructs.ApiTestInfo, error)

func (*Service) ListFileRecords

func (*Service) ListTestCases

func (svc *Service) ListTestCases(req apistructs.TestCaseListRequest) ([]apistructs.TestCase, []uint64, error)

ListTestCases return result TestCases, TestCaseIDs and error if have.

func (*Service) ListTestCasesDeep

func (svc *Service) ListTestCasesDeep(req apistructs.TestCaseListRequest) ([]uint64, error)

func (*Service) MarkFileRecordAsTimeout

func (svc *Service) MarkFileRecordAsTimeout(timeout time.Duration) error

func (*Service) PagingTestCases

PagingTestCases 测试用例分页查询

func (*Service) UpdateAPI

func (svc *Service) UpdateAPI(req apistructs.ApiTestsUpdateRequest) (int64, error)

func (*Service) UpdateFileRecord

func (svc *Service) UpdateFileRecord(req apistructs.TestFileRecordRequest) error

func (*Service) UpdateTestCase

func (svc *Service) UpdateTestCase(req apistructs.TestCaseUpdateRequest) error

UpdateTestCase 更新测试用例

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL