Documentation ¶
Overview ¶
Package report defines allure reporting structures.
Index ¶
- Constants
- func MediaType(t string) string
- type Attachment
- type Container
- type Executor
- type Formatter
- func (f *Formatter) BytesAttachment(content []byte, mediaType string) (*Attachment, error)
- func (f *Formatter) Finish(exec Executor)
- func (f *Formatter) Init() error
- func (f *Formatter) StartNewResult(res Result)
- func (f *Formatter) StepFinished(name string, status Status, statusDetails *StatusDetails, ...)
- func (f *Formatter) TableAttachment(table [][]string) (*Attachment, error)
- func (f *Formatter) WriteJSON(name string, v interface{})
- func (f *Formatter) WriteResult(r *Result)
- type Label
- type Link
- type LinkType
- type Parameter
- type Result
- type Status
- type StatusDetails
- type Step
- type TimestampMs
Constants ¶
const ( Broken = Status("broken") Passed = Status("passed") Failed = Status("failed") Skipped = Status("skipped") Unknown = Status("unknown") )
Available statuses.
const (
// CSVMime is a media type.
CSVMime = "text/csv"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Attachment ¶
type Attachment struct { Name string `json:"name"` Source string `json:"source"` Type string `json:"type"` }
Attachment can be attached.
func NewAttachment ¶
func NewAttachment(name string, mimeType string, resultsPath string, content []byte) (*Attachment, error)
NewAttachment creates and stores attachment.
type Container ¶
type Container struct { UUID string `json:"uuid,omitempty"` Name string `json:"name"` Children []string `json:"children"` Start TimestampMs `json:"start,omitempty"` Stop TimestampMs `json:"stop,omitempty"` }
Container lists all results.
type Executor ¶
type Executor struct { Name string `json:"name,omitempty" example:"Jenkins"` // Type may be one of [github, gitlab, teamcity, bamboo, jenkins] or a custom one. Type string `json:"type,omitempty" example:"jenkins"` URL string `json:"url,omitempty" example:"url"` BuildOrder int `json:"buildOrder,omitempty" example:"13"` BuildName string `json:"buildName,omitempty" example:"allure-report_deploy#13"` BuildURL string `json:"buildUrl,omitempty" example:"http://example.org/build#13"` ReportURL string `json:"reportUrl,omitempty" example:"http://example.org/build#13/AllureReport"` ReportName string `json:"reportName,omitempty" example:"Demo allure report"` }
Executor describes execution context.
type Formatter ¶
type Formatter struct { Container *Container Res *Result LastTime TimestampMs ResultsPath string // contains filtered or unexported fields }
Formatter writes test results as Allure report.
func (*Formatter) BytesAttachment ¶
func (f *Formatter) BytesAttachment(content []byte, mediaType string) (*Attachment, error)
BytesAttachment creates scalar attachment.
func (*Formatter) StartNewResult ¶
StartNewResult finishes previous Result and starts new.
func (*Formatter) StepFinished ¶
func (f *Formatter) StepFinished(name string, status Status, statusDetails *StatusDetails, prepareStep func(s *Step))
StepFinished finishes step and updates result.
func (*Formatter) TableAttachment ¶
func (f *Formatter) TableAttachment(table [][]string) (*Attachment, error)
TableAttachment creates table attachment.
func (*Formatter) WriteResult ¶
WriteResult writes single result.
type Link ¶
type Link struct { Name string `json:"name,omitempty"` Type LinkType `json:"type,omitempty"` URL string `json:"url,omitempty"` }
Link references additional resources.
type Result ¶
type Result struct { UUID string `json:"uuid,omitempty"` HistoryID string `json:"historyId,omitempty"` Name string `json:"name,omitempty"` Description string `json:"description,omitempty"` Status Status `json:"status,omitempty"` StatusDetails *StatusDetails `json:"statusDetails,omitempty"` Stage string `json:"stage,omitempty"` // "finished" Steps []Step `json:"steps,omitempty"` Attachments []Attachment `json:"attachments,omitempty"` Parameters []Parameter `json:"parameters,omitempty"` Start TimestampMs `json:"start,omitempty"` Stop TimestampMs `json:"stop,omitempty"` Children []string `json:"children,omitempty"` FullName string `json:"fullName,omitempty"` Labels []Label `json:"labels,omitempty"` Links []Link `json:"links,omitempty"` }
Result is the top level report object for a test.
18 known properties: "start", "descriptionHtml", "parameters", "name", "historyId", "statusDetails", "status", "links", "fullName", "uuid", "description", "testCaseId", "stage", "labels", "stop", "steps", "rerunOf", "attachments".
type StatusDetails ¶
type StatusDetails struct { Known bool `json:"known,omitempty"` Muted bool `json:"muted,omitempty"` Flaky bool `json:"flaky,omitempty"` Message string `json:"message,omitempty"` Trace string `json:"trace,omitempty"` }
StatusDetails provides additional information on status.
type Step ¶
type Step struct { Name string `json:"name,omitempty"` Status Status `json:"status,omitempty"` StatusDetails *StatusDetails `json:"statusDetails,omitempty"` Stage string `json:"stage"` ChildrenSteps []Step `json:"steps,omitempty"` Attachments []Attachment `json:"attachments,omitempty"` Parameters []Parameter `json:"parameters,omitempty"` Start TimestampMs `json:"start"` Stop TimestampMs `json:"stop"` }
Step is a part of scenario result.
func StepFinished ¶ added in v0.2.1
func StepFinished(res *Result, name string, status Status, statusDetails *StatusDetails, prepareStep func(s *Step), start TimestampMs) Step
StepFinished updates result with a finished step.