test_explorer

package
v1.0.37 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TestingItemKind_Dir  = "dir"
	TestingItemKind_File = "file"
	TestingItemKind_Case = "case"
)

Variables

This section is empty.

Functions

func Main

func Main(args []string, opts *Options) error

Types

type BaseRequest

type BaseRequest struct {
	Name string `json:"name"`
	File string `json:"file"`
}

type DetailRequest

type DetailRequest struct {
	*BaseRequest
	Line int `json:"line"`
}

type DetailResponse

type DetailResponse struct {
	Content string `json:"content"`
}

type Event

type Event string
const (
	Event_ItemStatus Event = "item_status"
	Event_Output     Event = "output"
	Event_ErrorMsg   Event = "error_msg"
	Event_TestStart  Event = "test_start"
	Event_TestEnd    Event = "test_end"
)

type GoConfig

type GoConfig struct {
	Min string `json:"min"`
	Max string `json:"max"`
}

type Options

type Options struct {
	// by default go
	DefaultGoCommand string
	GoCommand        string
	ProjectDir       string
	Exclude          []string
	Flags            []string
}

type PollSessionRequest

type PollSessionRequest struct {
	ID string `json:"id"`
}

type PollSessionResult

type PollSessionResult struct {
	Events []*TestingItemEvent `json:"events"`
}

type RunRequest

type RunRequest struct {
	*BaseRequest
	Path    []string `json:"path"`
	Verbose bool     `json:"verbose"`
}

type RunResult

type RunResult struct {
	Status RunStatus `json:"status"`
	Msg    string    `json:"msg"`
}

type RunStatus

type RunStatus string
const (
	RunStatus_NotRun  RunStatus = "not_run"
	RunStatus_Success RunStatus = "success"
	RunStatus_Fail    RunStatus = "fail"
	RunStatus_Error   RunStatus = "error"
	RunStatus_Running RunStatus = "running"
	RunStatus_Skip    RunStatus = "skip"
)

type StartSessionRequest

type StartSessionRequest struct {
	*TestingItem
}

type StartSessionResult

type StartSessionResult struct {
	ID string `json:"id"`
}

type TestConfig

type TestConfig struct {
	Go      *GoConfig
	GoCmd   string
	Exclude []string
	Env     map[string]interface{}

	// test flags passed to go test
	// common usages:
	//   -p=12            parallel programs
	//   -parallel=12     parallel test cases within the same test
	// according to our test, -p is more useful than -parallel
	Flags []string
}

func (*TestConfig) CmdEnv

func (c *TestConfig) CmdEnv() []string

type TestEvent

type TestEvent struct {
	Time    time.Time // encodes as an RFC3339-format string
	Action  TestEventAction
	Package string
	Test    string
	Elapsed float64 // seconds
	Output  string
}

from go/cmd/test2json

type TestEventAction

type TestEventAction string

see https://pkg.go.dev/cmd/test2json#hdr-Output_Format

const (
	TestEventAction_Start  TestEventAction = "start"
	TestEventAction_Run    TestEventAction = "run"
	TestEventAction_Pass   TestEventAction = "pass"
	TestEventAction_Pause  TestEventAction = "pause"
	TestEventAction_Cont   TestEventAction = "cont"
	TestEventAction_Bench  TestEventAction = "bench"
	TestEventAction_Output TestEventAction = "output"
	TestEventAction_Fail   TestEventAction = "fail"
	TestEventAction_Skip   TestEventAction = "skip"
)

type TestingItem

type TestingItem struct {
	Name    string          `json:"name"`
	RelPath string          `json:"relPath"`
	File    string          `json:"file"`
	Line    int             `json:"line"`
	Kind    TestingItemKind `json:"kind"`
	Error   string          `json:"error"`

	// only if Kind==dir
	// go only
	HasTestGoFiles bool `json:"hasTestGoFiles"`

	// when filter is not
	// go only
	HasTestCases bool `json:"hasTestCases"`

	Children []*TestingItem `json:"children"`
}

type TestingItemEvent

type TestingItemEvent struct {
	Event  Event        `json:"event"`
	Item   *TestingItem `json:"item"`
	Status RunStatus    `json:"status"`
	Msg    string       `json:"msg"`
}

type TestingItemKind

type TestingItemKind string

Jump to

Keyboard shortcuts

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