tests

package
v0.0.0-...-ab8afbf Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2021 License: MIT Imports: 4 Imported by: 0

README

tests

一些测试所用的mock

db.go 实现了数据库连接的mock和 foundation-go/database.DB 的模拟. mocks/ 文件夹是使用gomock生成的外层接口的mock文件. 生成方法参考 Makefile

具体的使用示例参考 使用示例

常用命令

# 执行特定的单元测试.
go test -v -cpu=1 --count=1 -timeout 30s github.com/xgxw/toddler-go/internal/services --run TestDemoService
# -v 表示显示测试执行的详细信息
# --run 参数支持正则, 会执行所有以 TestDemoService 开头的单元测试. 

# 运行所有单元测试
go test ./...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MockDB

func MockDB(t *testing.T) (*database.DB, sqlmock.Sqlmock, func())

Types

This section is empty.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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