common

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResultFormat         = "resultFormat"
	Allure2ResultsFormat = "allure2"
)
View Source
const (
	CtxInputDirPathKey         ContextKey = "inputDirPath"
	CtxOutputDirPathKey        ContextKey = "outputDirPath"
	CtxContainerResultsKey     ContextKey = "containerResults"
	CtxCurrentProcessorNameKey ContextKey = "currentProcessorName"
	CtxWriteData               ContextKey = "writeData"
	CtxUseBars                 ContextKey = "useBars"

	SerialVersionUID int64 = 1
	StatusFailed           = "failed"
	StatusBroken           = "broken"
	StatusPassed           = "passed"
	StatusSkipped          = "skipped"
	StatusUnknown          = "unknown"

	TestClassLabelName  = "testClass"
	TestMethodLabelName = "testMethod"
)

Variables

This section is empty.

Functions

func ConvertStatus

func ConvertStatus(status string) string

func CopyAttachment

func CopyAttachment(ctx context.Context, old *AttachmentResult, value *Attachment) error

func GetLabelByName

func GetLabelByName(labels []*Label, name string) string

func HasTestStage

func HasTestStage(result *TestResult) bool

func MergeTreeLeaf

func MergeTreeLeaf(sum *TreeLeaf, added *TreeLeaf)

Types

type Attachment

type Attachment struct {
	Uid       string `json:"uid"`
	Size      int64  `json:"size"`
	Name      string `json:"name"`
	OldSource string `json:"-"`
	Source    string `json:"source"`
	Type      string `json:"type"`
}

func ConvertAttachment

func ConvertAttachment(attachment *AttachmentResult, args ...any) *Attachment

func ReadAttachment

func ReadAttachment(ctx context.Context, item *AttachmentResult) (*Attachment, error)

func (*Attachment) String

func (a *Attachment) String() string

type AttachmentResult

type AttachmentResult struct {
	Name   string `json:"name"`
	Source string `json:"source"`
	Type   string `json:"type"`
}

type ContextKey

type ContextKey string

type FixtureResult

type FixtureResult struct {
	Fixtures map[string]*Fixtures
}

type Fixtures

type Fixtures struct {
	Befores []*StageResult `json:"befores"`
	Afters  []*StageResult `json:"afters"`
}

type Label

type Label struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

func AddLabelIfNotExists

func AddLabelIfNotExists(labels []*Label, name string, value string) []*Label

func GetLabel

func GetLabel(label *Label, _ ...any) *Label

func (*Label) String

func (l *Label) String() string
type Link struct {
	Name string `json:"name"`
	Url  string `json:"url"`
	Type string `json:"type"`
}
func GetLink(link *Link, _ ...any) *Link

type Parameter

type Parameter struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
}

func ConvertParameter

func ConvertParameter(parameter *ParameterResult, _ ...any) *Parameter

type ParameterResult

type ParameterResult struct {
	Name     string `json:"name"`
	Value    string `json:"value"`
	Excluded bool   `json:"excluded"`
	Mode     string `json:"mode"` //enum
}

type PluginResult

type PluginResult struct {
	Data []any
}

type StageResult

type StageResult struct {
	Summarizable
	Time            *Time  `json:"time,omitempty"`
	Description     string `json:"description"`
	DescriptionHtml string `json:"descriptionHtml,omitempty"`
	Status          string `json:"status"`
	StatusTrace     string `json:"statusTrace,omitempty"`
}

func ConvertStageResult

func ConvertStageResult(f *StepResult, args ...any) *StageResult

func GetTestStage

func GetTestStage(t *TestResult, args ...any) *StageResult

func (*StageResult) MarshalJSON

func (s *StageResult) MarshalJSON() ([]byte, error)

type Statistic

type Statistic struct {
	Failed  int64 `json:"failed"`
	Broken  int64 `json:"broken"`
	Skipped int64 `json:"skipped"`
	Passed  int64 `json:"passed"`
	Unknown int64 `json:"unknown"`
}

func (*Statistic) GetTotal

func (s *Statistic) GetTotal() int64

func (*Statistic) MarshalJSON

func (s *Statistic) MarshalJSON() ([]byte, error)

func (*Statistic) MergeStatistic

func (s *Statistic) MergeStatistic(another *Statistic)

func (*Statistic) UpdateStatistic

func (s *Statistic) UpdateStatistic(status string)

type StatusDetails

type StatusDetails struct {
	Known   bool   `json:"known"`
	Muted   bool   `json:"muted"`
	Flaky   bool   `json:"flaky"`
	Message string `json:"message"`
	Trace   string `json:"trace"`
}

type Step

type Step struct {
	Summarizable
	Time *Time `json:"time,omitempty"`

	Status      string `json:"status"`
	StatusTrace string `json:"statusTrace,omitempty"`
}

func ConvertStep

func ConvertStep(s *StepResult, args ...any) *Step

func (*Step) MarshalJSON

func (s *Step) MarshalJSON() ([]byte, error)

type StepResult

type StepResult struct {
	Name            string             `json:"name"`
	Status          string             `json:"status"`
	StatusDetails   StatusDetails      `json:"statusDetails"`
	Stage           string             `json:"stage"`
	Description     string             `json:"description"`
	DescriptionHtml string             `json:"descriptionHtml"`
	Steps           []StepResult       `json:"steps"`
	Attachments     []AttachmentResult `json:"attachments"`
	Parameters      []ParameterResult  `json:"parameters"`
	Start           int64              `json:"start"`
	Stop            int64              `json:"stop"`
}

type Summarizable

type Summarizable struct {
	Name          string        `json:"name,omitempty"`
	StatusMessage string        `json:"statusMessage,omitempty"`
	Steps         []*Step       `json:"steps"`
	Attachments   []*Attachment `json:"attachments"`
	Parameters    []*Parameter  `json:"parameters"`
}

func (*Summarizable) GetAttachmentCount

func (s *Summarizable) GetAttachmentCount() int

func (*Summarizable) GetStepsCount

func (s *Summarizable) GetStepsCount() int

func (*Summarizable) HasContent

func (s *Summarizable) HasContent() bool

func (*Summarizable) IsAttachmentStep

func (s *Summarizable) IsAttachmentStep() bool

func (*Summarizable) ShouldDisplayMessage

func (s *Summarizable) ShouldDisplayMessage() bool

type Test

type Test struct {
	Uid                 string `json:"uid"`
	Name                string `json:"name"`
	FullName            string `json:"fullName"`
	HistoryId           string `json:"historyId"`
	TestId              string `json:"testId,omitempty"`
	Time                *Time  `json:"time,omitempty"`
	Description         string `json:"description"`
	DescriptionHtml     string `json:"descriptionHtml,omitempty"`
	Status              string `json:"status"`
	StatusMessage       string `json:"statusMessage,omitempty"`
	StatusTrace         string `json:"statusTrace,omitempty"`
	Flaky               bool   `json:"flaky"`
	NewFailed           bool   `json:"newFailed"`
	NewBroken           bool   `json:"newBroken"`
	NewPassed           bool   `json:"newPassed"`
	RetriesCount        int    `json:"retriesCount"`
	RetriesStatusChange bool   `json:"retriesStatusChange"`

	//    Execution
	BeforeStages []*StageResult `json:"beforeStages"`
	TestStage    *StageResult   `json:"testStage"`
	AfterStages  []*StageResult `json:"afterStages"`

	//    Meta
	Labels     []*Label       `json:"labels"`
	Parameters []*Parameter   `json:"parameters"`
	Links      []*Link        `json:"links"`
	Hidden     bool           `json:"hidden"`
	Retry      bool           `json:"retry"`
	Extra      map[string]any `json:"extra"`
}

func ConvertTest

func ConvertTest(t *TestResult, args ...any) *Test

type TestResult

type TestResult struct {
	Uuid            string             `json:"uuid"`
	HistoryId       string             `json:"historyId"`
	TestCaseId      string             `json:"testCaseId"`
	TestCaseName    string             `json:"testCaseName"`
	FullName        string             `json:"fullName"`
	Labels          []Label            `json:"labels"`
	Links           []Link             `json:"links"`
	Name            string             `json:"name"`
	Status          string             `json:"status"` //enum
	StatusDetails   StatusDetails      `json:"statusDetails"`
	Stage           string             `json:"stage"` //enum
	Description     string             `json:"description"`
	DescriptionHtml string             `json:"descriptionHtml"`
	Steps           []StepResult       `json:"steps"`
	Attachments     []AttachmentResult `json:"attachments"`
	Parameters      []ParameterResult  `json:"parameters"`
	Start           int64              `json:"start"`
	Stop            int64              `json:"stop"`
}

type TestResultContainer

type TestResultContainer struct {
	Uuid            string       `json:"uuid"`
	Name            string       `json:"name"`
	Children        []string     `json:"children"`
	Description     string       `json:"description"`
	DescriptionHtml string       `json:"descriptionHtml"`
	Befores         []StepResult `json:"befores"`
	Afters          []StepResult `json:"afters"`
	Links           []Link       `json:"links"`
	Start           int64        `json:"start"`
	Stop            int64        `json:"stop"`
}

type Time

type Time struct {
	Start    int64 `json:"start"`
	Stop     int64 `json:"stop"`
	Duration int64 `json:"duration"`
}

func ConvertTime

func ConvertTime(start int64, stop int64) *Time

type TreeLeaf

type TreeLeaf struct {
	Uid                 string      `json:"uid"`
	Name                string      `json:"name"`
	Children            []*TreeLeaf `json:"children,omitempty"`
	ParentUid           string      `json:"parentUid,omitempty"`
	Status              string      `json:"status,omitempty"`
	Time                *Time       `json:"time,omitempty"`
	Flaky               bool        `json:"flaky,omitempty"`
	NewFailed           bool        `json:"newFailed,omitempty"`
	NewPassed           bool        `json:"newPassed,omitempty"`
	NewBroken           bool        `json:"newBroken,omitempty"`
	RetriesCount        int         `json:"retriesCount,omitempty"`
	RetriesStatusChange bool        `json:"retriesStatusChange,omitempty"`
	Parameters          []string    `json:"parameters,omitempty"`
	Tags                []string    `json:"tags,omitempty"`
}

func NewTreeLeaf

func NewTreeLeaf(parentUid string, name string) *TreeLeaf

func TreeLeafFromTest

func TreeLeafFromTest(parentUid string, result *Test) *TreeLeaf

func (*TreeLeaf) GetLeafByLabelName

func (t *TreeLeaf) GetLeafByLabelName(labels []*Label, labelName string) *TreeLeaf

func (*TreeLeaf) GetLeafs

func (t *TreeLeaf) GetLeafs(names ...string) []*TreeLeaf

func (*TreeLeaf) GetStatistic

func (t *TreeLeaf) GetStatistic() *Statistic

func (*TreeLeaf) GetWidgetData

func (t *TreeLeaf) GetWidgetData() *WidgetData

type TrendItem

type TrendItem struct {
	Data map[string]int64 `json:"data"`
}

type WidgetData

type WidgetData struct {
	Total int64         `json:"total"`
	Items []*WidgetItem `json:"items,omitempty"`
}

func (*WidgetData) ToTrendItem

func (w *WidgetData) ToTrendItem() *TrendItem

type WidgetItem

type WidgetItem struct {
	Uid       string     `json:"uid"`
	Name      string     `json:"name"`
	Statistic *Statistic `json:"statistic,omitempty"`
}

Jump to

Keyboard shortcuts

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