Documentation
¶
Index ¶
- Constants
- func FileCompare(path string, expected []byte) bool
- func FileExist(path string) bool
- func MongoCompare[T any](database *mongo.Database, table, field, key string, expected *T, ...) bool
- func MongoExist(database *mongo.Database, table, field, key string) bool
- func ProtoEqual(expected, actual any, option ...cmp.Option) bool
- func ProtoListContain[T any](expected any, actual []T, option ...cmp.Option) bool
- func ProtoListEqual[T any](expected, actual []T, option ...cmp.Option) bool
- func ProtoListExist(expected any, actual []proto.Message) bool
- func RedisCompare[T any](client redis.Cmdable, key string, expected *T, option ...cmp.Option) bool
- func RedisCompareList[T any](client redis.Cmdable, key string, expected []*T, option ...cmp.Option) bool
- func RedisExist(client redis.Cmdable, key string) bool
- func Restore(catalog Catalog)
- func Root() string
- func Shell(m *testing.M, initialize, finalize func(), work string, from ...string) (result int)
- func WaitTimeout(duration ...time.Duration)
- type Catalog
Constants ¶
View Source
const Timeout = time.Millisecond * 200 // 預設等待時間
Variables ¶
This section is empty.
Functions ¶
func MongoCompare ¶
func MongoCompare[T any](database *mongo.Database, table, field, key string, expected *T, option ...cmp.Option) bool
MongoCompare 在mongo中比對資料是否相同
func MongoExist ¶
MongoExist 在mongo中資料是否存在
func ProtoEqual ¶ added in v1.1.20
ProtoEqual 訊息是否符合
func ProtoListContain ¶ added in v1.1.41
ProtoListContain 訊息列表是否包含指定訊息
func ProtoListEqual ¶ added in v1.1.41
ProtoListEqual 訊息列表是否符合
func ProtoListExist ¶ added in v1.1.41
ProtoListExist 訊息列表是否包含指定類型
func RedisCompare ¶
RedisCompare 在redis中比對資料是否相同
func RedisCompareList ¶ added in v1.1.49
func RedisCompareList[T any](client redis.Cmdable, key string, expected []*T, option ...cmp.Option) bool
RedisCompareList 在redis中比對列表是否相同
func Restore ¶
func Restore(catalog Catalog)
Restore 還原測試目錄, 依照以下流程執行
- 工作目錄改為目錄資料中的原始路徑
- 刪除目錄資料中的工作路徑及其所有內容
func Shell ¶
Shell 測試框架處理, 依照以下流程執行
- 使用 Prepare 準備測試目錄
- 執行初始化處理
- 執行單元測試
- 執行結束處理
- 使用 Restore 還原測試目錄
- 回傳單元測試的結果編號, 可用此編號呼叫 os.Exit, 讓外部能夠獲得測試結果
func WaitTimeout ¶
WaitTimeout 等待超時時間, 可以輸入等待時間, 預設等待200毫秒
Types ¶
Click to show internal directories.
Click to hide internal directories.