suite

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package suite provides the definition of a test suite as well as a mechanism to load multiple test suites from multiple sources through the Loader interface. A Suite is uniquely associated with a rule: each loaded test is associated with a specific Suite, depending on the rule name it specifies on its description. If the user didn't specify any rule name in the test description, the test is associated with the test suite corresponding to NoRuleNamePlaceholder. The Loader can be used to load multiple test suites from multiple sources. Loader.Load accepts Source objects; a Source is a named io.Reader.

Index

Constants

View Source
const NoRuleNamePlaceholder = ""

NoRuleNamePlaceholder is the value given to the rule name field of a test not specifying any value for it. Notice: whe choose the empty string as it is not a valid rule name.

Variables

This section is empty.

Functions

This section is empty.

Types

type Loader

type Loader interface {
	// Load loads the test suites from the provided source into the Loader instance. Load can be called multiple times
	// with different sources. Call Get to obtain the list of all loaded test suites. If an error is generated, the
	// Loader instance internal state remains undefined.
	Load(source Source) error
	// Get returns the list of all loaded test suites. After the call, the internal state of the loaded is re-set to a
	// clean (initial) state.
	Get() []*Suite
}

Loader allows to load multiple test suites from multiple sources.

type NoRuleNameError

type NoRuleNameError struct {
	TestName        string
	TestSourceName  string
	TestSourceIndex int
}

NoRuleNameError represents an error occurring when is not allowed to load tests with absent or empty rule name and a test doesn't specify it.

func (*NoRuleNameError) Error

func (e *NoRuleNameError) Error() string

type Report

type Report struct {
	TestSuiteName string           `json:"suite" yaml:"suite"`
	TestReports   []*tester.Report `json:"testReports" yaml:"testReports"`
}

A Report contains test reports for all tests belonging to a test suite.

type ReportEncoder

type ReportEncoder interface {
	// Encode encodes the provided report with a specific format and write it to the underlying destination.
	Encode(report *Report) error
}

ReportEncoder allows to encode a report.

type Source

type Source interface {
	// Name returns the name associated to the source.
	Name() string
	io.Reader
}

Source represents a test suite source. It is an io.Reader owning a name.

type Suite

type Suite struct {
	// RuleName is the name of the rule the tests are associated with.
	RuleName string
	// TestsInfo contains the list of tests belonging to the suite.
	TestsInfo []*TestInfo
}

Suite represents a test suite for a specific rule.

type TestInfo

type TestInfo struct {
	// SourceName is the name of the source the test belongs.
	SourceName string
	// Test is the wrapped test.
	Test *loader.Test
}

TestInfo wraps a test and provides additional information to it, such as the name of the source it belongs and its index within the source.

Directories

Path Synopsis
Package loader provides the implementation of a suite.Loader.
Package loader provides the implementation of a suite.Loader.
reportencoder
jsonencoder
Package jsonencoder provides an implementation of suite.ReportEncoder allowing to write a report to the underlying destination using a JSON encoding.
Package jsonencoder provides an implementation of suite.ReportEncoder allowing to write a report to the underlying destination using a JSON encoding.
textencoder
Package textencoder provides an implementation of suite.ReportEncoder allowing to write a report to the underlying destination using a formatted text encoding.
Package textencoder provides an implementation of suite.ReportEncoder allowing to write a report to the underlying destination using a formatted text encoding.
yamlencoder
Package yamlencoder provides an implementation of suite.ReportEncoder allowing to write a report to the underlying destination using a YAML encoding.
Package yamlencoder provides an implementation of suite.ReportEncoder allowing to write a report to the underlying destination using a YAML encoding.
Package source provides the implementation of a suite.Source.
Package source provides the implementation of a suite.Source.

Jump to

Keyboard shortcuts

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