Documentation ¶
Overview ¶
Package testcheck provides common functions to check test definitions.
Index ¶
- func Attr(t *gotesting.T, f TestFilter, requiredAttr []string)
- func Entities() map[string]Entity
- func IfAttr(t *gotesting.T, f TestFilter, criteriaAttr, requiredAttr []string)
- func SetAllTestsforTest(tests []*testing.TestInstance) func()
- func SoftwareDeps(t *gotesting.T, f TestFilter, requiredDeps []string)
- func Timeout(t *gotesting.T, f TestFilter, minTimeout time.Duration)
- type Entity
- type EntityType
- type TestFilter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Attr ¶
func Attr(t *gotesting.T, f TestFilter, requiredAttr []string)
Attr checks that tests matched by f declare requiredAttr as Attr. requiredAttr is a list of items which the test's Attr must have. Each item is one or '|'-connected multiple attr names, and Attr must contain at least one of them.
func IfAttr ¶
func IfAttr(t *gotesting.T, f TestFilter, criteriaAttr, requiredAttr []string)
IfAttr checks that tests matched by f declare requiredAttr as Attr if all Attr in criteriaAttr are present. criteriaAttr is a list of items to apply to test's Attr. requiredAttr is a list of items which the test's Attr must have if criteriaAttr are matched. Each item is one or '|'-connected multiple attr names, and Attr must contain at least one of them. Example, criteriaAttr=["A", "B|C"], requiredAttr=["D", "E|F"] Any tests with Attr A and either B or C should define Attr D and either E or F.
func SetAllTestsforTest ¶
func SetAllTestsforTest(tests []*testing.TestInstance) func()
SetAllTestsforTest sets all tests to use in this package. This is mainly used in unittest for testing purpose.
func SoftwareDeps ¶
func SoftwareDeps(t *gotesting.T, f TestFilter, requiredDeps []string)
SoftwareDeps checks that tests matched by f declare requiredDeps as software dependencies. requiredDeps is a list of items which the test's SoftwareDeps needs to satisfy. Each item is one or '|'-connected multiple software feature names, and SoftwareDeps must contain at least one of them. TODO: b/225978622 -- support multi-dut in test check.
Types ¶
type Entity ¶
type Entity struct { Type EntityType Name string Parent string PrivateAttrs map[string]struct{} Attrs map[string]struct{} }
Entity represents a node in the dependency graph of tests and fixtures.
func (*Entity) HasPrivateAttr ¶
HasPrivateAttr returns whether the node has a given private attribute.
type EntityType ¶
type EntityType int
EntityType represents a type of an entity, such as a test or a fixture.
const ( // Test represents that an entity is a test. Test EntityType = iota // Fixture represents that an entity is a fixture. Fixture )
func (EntityType) String ¶
func (e EntityType) String() string
type TestFilter ¶
type TestFilter func(t *testing.TestInstance) bool
TestFilter defines the condition whether or not the test should be checked.