tests

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Case

type Case struct {
	Method  string                 // 请求方法
	Uri     string                 // 请求路由
	Params  map[string]interface{} // 请求参数
	Code    int                    // 响应自定义状态码
	Message string                 // 响应自定义信息
	List    bool                   // 是否是列表
	Fields  []string               // 断言字段
	Print   bool                   // 是否打印
}

Case 测试用例

type SuiteCase

type SuiteCase struct {
	suite.Suite
	Guard         string
	Authorization string
	AppPrefix     string
}

SuiteCase 测试套件

func (*SuiteCase) AdminLogin

func (s *SuiteCase) AdminLogin()

AdminLogin 管理员登录 @return void

func (*SuiteCase) Assert

func (s *SuiteCase) Assert(testCase []Case)

Assert 断言 @param []Case testCase 测试用例切片 @return void

func (*SuiteCase) Request

func (s *SuiteCase) Request(method string, uri string, body map[string]interface{}) (
	c *gin.Context,
	r *http.Request,
	w *httptest.ResponseRecorder,
)

Request 发起请求 @param string method 请求方法 @param string url 请求链接 @param map[string]interface{} body 请求参数

func (*SuiteCase) SetupSuite

func (s *SuiteCase) SetupSuite()

SetupSuite 测试套件前置函数 @return void

func (*SuiteCase) TearDownSuite

func (s *SuiteCase) TearDownSuite()

TearDownSuite 测试套件后置函数 @return void

Jump to

Keyboard shortcuts

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