units

package module
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2024 License: MIT Imports: 11 Imported by: 34

README

units

为 starter 提供单元测试支持

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModuleMainT added in v0.0.4

func ModuleMainT() *application.ModuleBuilder

ModuleMainT 创建模块 github.com/starter-go/units

func ModuleTestT added in v0.0.4

func ModuleTestT() *application.ModuleBuilder

ModuleTestT 创建模块 github.com/starter-go/units

func Run added in v0.0.4

func Run(cfg *Config) error

Run ...

Types

type Config added in v0.0.4

type Config struct {

	// Args 启动的命令行参数
	Args []string

	// Cases : 一个名称列表(以','号分隔); 或者,'all' 表示执行所以的测试用例
	Cases string

	// 测试的目标模块
	Module application.Module

	// Properties 附加的属性表
	Properties map[string]string

	// 测试上下文
	T *testing.T

	// 使用 panic 代替 error
	UsePanic bool
}

Config ...

type Registration

type Registration struct {
	Name     string
	Enabled  bool
	Priority int
	Test     func() error
}

Registration 测试单元注册信息

type Runner

type Runner interface {
	Module(m application.Module) Runner

	Testing(t *testing.T) Runner

	EnablePanic(enabled bool) Runner

	SetProperties(table map[string]string) Runner

	Run(args []string) error
}

Runner 单元测试执行器

func NewRunner

func NewRunner() Runner

NewRunner 新建一个 Runner

type Units

type Units interface {
	Units(list []*Registration) []*Registration
}

Units 测试单元注册接口

Directories

Path Synopsis
gen
modules
src

Jump to

Keyboard shortcuts

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