allure

package
v0.0.0-...-f702ca3 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

README

pkg/allure

The allure package offers an implementation of all the entities that Allure uses to handle test reports.

💁 Learn more about the Allure Framework.

Head of contents

Global Environment Keys

Key Meaning Default
ALLURE_OUTPUT_PATH Specifies the path to the folder to print the results. . (test folder)
ALLURE_OUTPUT_FOLDER Specifies the name of a folder for printing results. /allure-results
ALLURE_ISSUE_PATTERN Specifies the URL pattern for Issue. Must contain exactly one %s.
ALLURE_TESTCASE_PATTERN Specifies the URL pattern for TestCase. Must contain exactly one %s.
ALLURE_LAUNCH_TAGS Specifies the default tags that will be used to mark all tests in the run. The tags must be specified separated by commas.

Status

Supported test statuses:

Name Key
Passed passed
Failed failed
Skipped skipped
Broken broken
Unknown unknown

NOTE: Tests failed in the BeforeAll/BeforeEach functions have the status Unknown

Attachment

allure.Attachment - is the implementation of the appendices to the report in allure. It is most often used to contain screenshots, api-answers, files and other data obtained during the test.

Attachment's Supported Types
Key Mime type File type
Text "text/plain" .txt
Csv "text/csv" .csv
Tsv "text/tab-separated-values" .tsv
URIList "text/uri-list" .uri
HTML "text/html" .html
XML "application/xml" .xml
JSON "application/json" .json
Yaml "application/yaml" .yaml
Pcap "application/vnd.tcpdump.pcap" .pcap
Png "image/png" .png
Jpg "image/jpg" .jpg
Svg "image/svg-xml" .svg
Gif "image/gif" .gif
Bmp "image/bmp" .bmp
Tiff "image/tiff" .tiff
Mp4 "video/mp4" .mp4
Ogg "video/ogg" .ogg
Webm "video/webm" .webm
Mpeg "video/mpeg" .mpeg
Pdf "application/pdf" .pdf
Attachment's Constructors
Function Description
NewAttachment(name string, mimeType MimeType, content []byte) *Attachment Returns pointer to the new allure.Attachment object.
Attachment's Methods
Method Description
GetUUID() string Returns attachment's UUID
GetContent() []byte Returns attachment's Content
Print() error Creates a file from Attachment.content. The file type is determined by its Attachment.mimeType.

Container

allure.Container - This is an implementation of the Container entity used by Allure to handle TestSetup and TestTeardown hooks. The list of The list of container-dependent tests is contained in the array Container.Children.

Container's Constructors
Function Description
NewContainer() *Container Returns pointer to the new allure.Container object.
Container's Methods
Method Description
GetUUID() string Returns container's UUID.
AddChild(childUUID uuid.UUID) Adds passed UUID as child.
IsEmpty() bool Returns true if arrays Container.Befores and Container.Afters are empty.
Print() error Creates xxxxxx-container.json file and call PrintAttachments if any step exists in Container.Befores and Container.Afters.
ToJSON() ([]byte, error) Marshall allure.Container to the JSON. Returns error if has any.
PrintAttachments() PrintAttachments It goes through all Container.Befores and Container.Afters of the Container and calls the Container.PrintAttachments() method at each allure.Step.
Begin() Sets Container.Start = allure.GetNow().
Finish() Sets Container.Stop = allure.GetNow().
Done() error Calls Finish() and Print() methods. Returns error if has any.

Label

Label - implementation of the Label entity used by Allure for metrics and test grouping.

Supported Label Types and Severity levels

Label Types:

Name Key
Epic epic
Feature feature
Story story
ID as_id
Severity severity
ParentSuite parentSuite
Suite suite
SubSuite subSuite
Package package
Thread thread
Host host
Tag tag
Framework framework
Language language
Owner owner
Lead lead
AllureID ALLURE_ID

Severity levels:

Name Key
BLOCKER blocker
CRITICAL critical
NORMAL normal
MINOR minor
TRIVIAL trivial
Label's Constructors
Function Description
NewLabel(labelType LabelType, value string) Label Builds and returns a new allure.Label. The label key depends on the passed LabelType.
EpicLabel (epic string) Label Returns new Epic label
FeatureLabel (feature string) Label Returns new Feature label
StoryLabel (story string) Label Returns new Story label
IDLabel (testID string) Label Returns new ID label
SeverityLabel (severity SeverityType) Label Returns new Severity label
ParentSuitLabel (parent string) Label Returns new ParentSuite label
SuiteLabel (suite string) Label Returns new Suite label
SubSuiteLabel (subSuite string) Label Returns new SubSuite label
PackageLabel (package string) Label Returns new Package label
ThreadLabel (thread string) Label Returns new Thread label
HostLabel (host string) Label Returns new Host label
TagLabel (tag string) Label Returns new Tag label
TagLabels(tags ...string) []Label Returns as many new Tag labels as passed strings in args
FrameworkLabel (framework string) Label Returns new Framework label
LanguageLabel (language string) Label Returns new Language label
OwnerLabel (owner string) Label Returns new Owner label
LeadLabel (lead string) Label Returns new Lead label
IDAllureLabel (allureID string) Label Returns new AllureID label

Link - is an implementation of the Link entity used by Allure to specify the links needed for test reporting.

Name Key Description
LINK link Custom link
ISSUE issue Link to the Issue in your CMS
TESTCASE test_case Link to the TestCase in your TMS
Function Description
NewLink(name string, _type LinkTypes, url string) Link Base constructor. Returns new allure.Link.
TestCaseLink(testCase string) Link Returns TESTCASE type link. It uses environment variable ALLURE_TESTCASE_PATTERN as pattern.
IssueLink(issue string) Link Returns ISSUE type link. It uses environment variable ALLURE_ISSUE_PATTERN as pattern.
LinkLink(linkname, link string) Link Returns LINK type link.

NOTE: Check more about patterns here

Parameter

Parameter - is an implementation of the Parameter entity, which Allure uses as additional information describing the test step (e.g. request host or server address).

Parameter's Constructors
Function Description
NewParameter(name string, value ...interface{}) Parameter Builds new Parameter object. Value must be able to cast to string.
NewParameters(kv ...interface{}) []Parameter Returns list of allure.Parameter objects. Each even string is considered a parameter name, and each odd-value of the parameter.

Result

Result - is an implementation of the Result entity used by Allure to store information about the test. It contains information about the test name, applications, description, status, references, labels, steps, containers, and time test execution time.

Result's Constructors
Function Description
NewResult(testName, fullName string) *Result Builds a new allure.Result. Sets the default values for the structure.
Result's methods
Method Description
SetStatusMessage(msg string) Sets Result.StatusDetails.Message.
ToJSON() ([]byte, error) Marshall allure.Result to JSON, returns error if has any
GetStatusMessage() string Returns Result.StatusDetails.Trace.
SetStatusTrace(trace string) Sets Result.StatusDetails.Trace.
GetStatusTrace() string Returns Result.StatusDetails.Trace.
SetLabel(labels ...Label) Sets all labels passed as arguments to allure.Result.
GetLabel(labelType LabelType) []Label Returns all labels with keys to allure.Result.
SetNewLabelMap(kv map[LabelType]string) Sets new labels with map to allure.Result.
WithParentSuite(parentName string) *Result Sets ParentSuite label allure.Result.
WithSuite(suiteName string) *Result Sets Suite label allure.Result.
WithHost(hostName string) *Result Sets Host label allure.Result.
WithSubSuites(children ...string) *Result Sets all SubSuite labels to allure.Result.
WithFrameWork(framework string) *Result Sets Framework label to allure.Result.
WithLanguage(language string) *Result Sets Language label to allure.Result.
WithThread(thread string) *Result Sets Thread label to allure.Result.
WithPackage(pkg string) *Result Sets Package label to allure.Result.
WithLabels(label ...Label) *Result Sets all labels passed as arguments to allure.Result
WithLaunchTags() *Result Adds all Launch Tags from the global variable ALLURE_LAUNCH_TAGS as labels with type Tag to the report.
Begin() *Result Sets Result.Start == allure.GetNow().
Finish() *Result Sets Result.Stop == allure.GetNow().
SkipOnPrint() Skips result from printing when Result.Print() called.
Print() error If Result.ToPrint == false creates uuid4-result.json and call Print() method for all attachments and step's attachments.
PrintAttachments() Goes through all Result.Steps of the report and for each allure.Step calls the Step.PrintAttachments() method.Then calls Attachment.Print() on all allure.Attachment of the Result.Attachments list.
Done() error If Result.Status is not filled in, consider the test successfully completed (no errors). After that - it calls Finish() and Print() methods. Returns error if has any.

Step

Step - is an implementation of the Step entity used by Allure to define and describe test steps.

Steps can be nested, have a status (successful, failed, skipped, broken), can contain Attachments and Parameters and have an execution time

Step's Constructors
Function Description
NewStep(name string, status Status, start int64, stop int64, parameters []Parameter) *Step Returns pointer to the new allure.Step object.
NewSimpleStep(name string, parameters ...Parameter) *Step Same as NewStep but the most of fields are pre populated.
Step's methods
Method Description
GetParent() *Step Returns pointer to parent step (if any).
WithAttachments(attachments ...*Attachment) *Step Adds attachments to step.
WithParameters(params ...Parameter) *Step Adds Allure.Parameters to the step.
WithNewParameters(kv ...interface{}) *Step Creates new Allure.Parameters and attach them to the step.
Passed() *Step Marks step as Passed.
Failed() *Step Marks step as Failed.
Skipped() *Step Marks step as Skipped.
Broken() *Step Marks test as Broken.
Begin() *Step Sets Step.Start == allure.GetNow().
Finish() *Step Sets Step.Start == allure.GetNow().
WithParent(parent *Step) *Step Sets passed step as parent.
WithChild(child *Step) *Step Sets passed step as child.
PrintAttachments() Iterate throw list of attachments, attached to allure.Step and call Print() at each attachment.

NOTE: The most step methods can be called in chain of calls. Example:

package test

import (
	"github.com/ozontech/allure-go/pkg/allure"
	"github.com/ozontech/allure-go/pkg/framework/provider"
)

// ...

func (s *SomeSuite) SomeTest(t provider.T) {
	step := allure.NewSimpleStep("My First Step").WithNewParameters("k1", "v1").Passed().Finish()
	t.Step(step)
}

Documentation

Index

Constants

View Source
const (
	// DefaultVersion - allure-go current Version
	DefaultVersion = "Allure-Go@v0.6.0"
)

Variables

This section is empty.

Functions

func GetNow

func GetNow() int64

GetNow returns time.Now casted to int64 and time.Millisecond

Types

type Attachment

type Attachment struct {
	Name   string   `json:"name,omitempty"`   // Attachment name
	Source string   `json:"source,omitempty"` // Path to the Attachment file (name)
	Type   MimeType `json:"type,omitempty"`   // Mime-type of the Attachment
	// contains filtered or unexported fields
}

Attachment - is an implementation of the attachments to the report in allure. It is most often used to contain screenshots, responses, files and other data obtained during the test.

func NewAttachment

func NewAttachment(name string, mimeType MimeType, content []byte) *Attachment

NewAttachment - Constructor. Returns pointer to new attachment object.

func (*Attachment) GetContent

func (a *Attachment) GetContent() []byte

func (*Attachment) GetUUID

func (a *Attachment) GetUUID() string

func (*Attachment) Print

func (a *Attachment) Print() error

Print - Creates a file from `Attachment.content`. The file type is determined by its `Attachment.mimeType`.

type Container

type Container struct {
	UUID     uuid.UUID   `json:"uuid,omitempty"`     // Unique identifier of the container
	Children []uuid.UUID `json:"children,omitempty"` // UUID array containing all reports referring to the container
	Befores  []*Step     `json:"befores,omitempty"`  // Array of pointers to allure.Step in Test Setup
	Afters   []*Step     `json:"afters,omitempty"`   // Array of pointers to allure.Step in Test TearDown
	Start    int64       `json:"start,omitempty"`    // Start time of the container
	Stop     int64       `json:"stop,omitempty"`     // Stop time of the container
}

Container This is an implementation of the `Container` entity used by Allure to handle TestSetup and TestTeardown hooks. The list of container-dependent tests is contained in the `Container.Children` array. Note: For Before/After Test hooks, the Container.Children array will contain one element (one container per test). For Before/After Suite hooks the Container.Children array will contain UUIDs of all tests for which the hook was executed.

func NewContainer

func NewContainer() *Container

NewContainer - Constructor. Builds and returns a new `allure.Container` object.

func (*Container) AddChild

func (container *Container) AddChild(childUUID uuid.UUID)

AddChild Adds a new child to the Container.Children array.

func (*Container) Begin

func (container *Container) Begin()

Begin Sets `Container.Start` = allure.GetNow()

func (*Container) Done

func (container *Container) Done() error

Done calls Finish and Print

func (*Container) Finish

func (container *Container) Finish()

Finish Sets Container.Stop = allure.GetNow()

func (*Container) IsEmpty

func (container *Container) IsEmpty() bool

IsEmpty Returns `true` if arrays Container.Befores and Container.Afters are empty.

func (*Container) Print

func (container *Container) Print() error

Print Checks the file with the function Container.IsEmpty: 1) if the container is empty, execution of the function completes without error. 2) If the container contains steps

  1. Call Container.PrintAttachments()
  2. Serializes the file into `uuid4-container.json`.
  3. Creates a file in the file system in the output folder (`$ALLURE_OUTPUT_PATH`/`$ALLURE_OUTPUT_FOLDER`). If there is an error during error occurs during execution - returns it

func (*Container) PrintAttachments

func (container *Container) PrintAttachments()

PrintAttachments It goes through all Container.Befores and Container.Afters of the Container and calls the Container.PrintAttachments() method at each allure.Step.

func (*Container) ToJSON

func (container *Container) ToJSON() ([]byte, error)

ToJSON marshall allure.Result to json file

type FileManager

type FileManager interface {
	CreateFile(name string, content []byte) error
}

func NewFileManager

func NewFileManager() FileManager

type Label

type Label struct {
	Name  string      `json:"name"`  // Label's name
	Value interface{} `json:"value"` // Label's value
}

Label is the implementation of the label. A label is an entity used by Allure to make metrics and grouping of tests.

func EpicLabel

func EpicLabel(epic string) *Label

EpicLabel returns Epic Label

func FeatureLabel

func FeatureLabel(feature string) *Label

FeatureLabel returns Feature Label

func FrameWorkLabel

func FrameWorkLabel(framework string) *Label

FrameWorkLabel returns Framework Label

func HostLabel

func HostLabel(host string) *Label

HostLabel returns Host Label

func IDAllureLabel

func IDAllureLabel(allureID string) *Label

IDAllureLabel returns AllureID Label

func IDLabel

func IDLabel(testID string) *Label

IDLabel returns ID Label

func LanguageLabel

func LanguageLabel(language string) *Label

LanguageLabel returns Language Label

func LayerLabel

func LayerLabel(layer string) *Label

LayerLabel returns Layer Label

func LeadLabel

func LeadLabel(leadName string) *Label

LeadLabel returns Lead Label

func NewLabel

func NewLabel(labelType LabelType, value string) *Label

NewLabel - builds and returns a new allure.Label. The label key depends on the passed LabelType.

func OwnerLabel

func OwnerLabel(ownerName string) *Label

OwnerLabel returns Owner Label

func PackageLabel

func PackageLabel(packageName string) *Label

PackageLabel returns Package Label

func ParentSuiteLabel

func ParentSuiteLabel(parent string) *Label

ParentSuiteLabel returns ParentSuite Label

func SeverityLabel

func SeverityLabel(severity SeverityType) *Label

SeverityLabel returns Severity Label

func StoryLabel

func StoryLabel(story string) *Label

StoryLabel returns Story Label

func SubSuiteLabel

func SubSuiteLabel(subSuite string) *Label

SubSuiteLabel returns SubSuite Label

func SuiteLabel

func SuiteLabel(suite string) *Label

SuiteLabel returns Suite Label

func TagLabel

func TagLabel(tag string) *Label

TagLabel returns Tag Label

func TagLabels

func TagLabels(tags ...string) []*Label

TagLabels returns array of Tag Label

func ThreadLabel

func ThreadLabel(thread string) *Label

ThreadLabel returns Thread Label

func (*Label) GetValue

func (l *Label) GetValue() string

GetValue returns label value as string

type LabelType

type LabelType string
const (
	Epic        LabelType = "epic"
	Layer       LabelType = "layer"
	Feature     LabelType = "feature"
	Story       LabelType = "story"
	ID          LabelType = "as_id"
	Severity    LabelType = "severity"
	ParentSuite LabelType = "parentSuite"
	Suite       LabelType = "suite"
	SubSuite    LabelType = "subSuite"
	Package     LabelType = "package"
	Thread      LabelType = "thread"
	Host        LabelType = "host"
	Tag         LabelType = "tag"
	Framework   LabelType = "framework"
	Language    LabelType = "language"
	Owner       LabelType = "owner"
	Lead        LabelType = "lead"
	AllureID    LabelType = "ALLURE_ID"
)

LabelType constants

func (LabelType) ToString

func (l LabelType) ToString() string
type Link struct {
	Name string `json:"name"` // Link name
	Type string `json:"type"` // Link's Type (issue, test case or any other)
	URL  string `json:"url"`  // Link URL
}

Link is an implementation of the Link entity used by Allure to specify the links needed for test reports. Such as: - A link to a task in Issue tracker. - A link to a test case in the TMS - Any other link (e.g. a link to an environment pod)

func IssueLink(issue string) *Link

IssueLink returns ISSUE type link

func LinkLink(linkname, link string) *Link

LinkLink returns LINK type link

func NewLink(name string, linkType LinkTypes, url string) *Link

NewLink Constructor. Builds and returns a new `allure.Link` object.

func TestCaseLink(testCase string) *Link

TestCaseLink returns TESTCASE type link

func TmsLink(testCase string) *Link

TmsLink returns TMS type link

func TmsLinks(testCases ...string) []*Link

TmsLinks returns multiple TmsLink type link

type LinkTypes

type LinkTypes string

LinkTypes ...

const (
	LINK     LinkTypes = "link"
	ISSUE    LinkTypes = "issue"
	TESTCASE LinkTypes = "test_case"
	TMS      LinkTypes = "tms"
)

LinkTypes constants

type MimeType

type MimeType string

MimeType is Attachment's mime type. See more: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types

const (
	Text    MimeType = "text/plain"
	Csv     MimeType = "text/csv"
	Tsv     MimeType = "text/tab-separated-values"
	URIList MimeType = "text/uri-list"

	HTML MimeType = "text/html"
	XML  MimeType = "application/xml"
	JSON MimeType = "application/json"
	Yaml MimeType = "application/yaml"
	Pcap MimeType = "application/vnd.tcpdump.pcap"

	Png  MimeType = "image/png"
	Jpg  MimeType = "image/jpg"
	Svg  MimeType = "image/svg-xml"
	Gif  MimeType = "image/gif"
	Bmp  MimeType = "image/bmp"
	Tiff MimeType = "image/tiff"

	Mp4  MimeType = "video/mp4"
	Ogg  MimeType = "video/ogg"
	Webm MimeType = "video/webm"
	Mpeg MimeType = "video/mpeg"

	Pdf  MimeType = "application/pdf"
	Xlsx MimeType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
)

Attachment's MimeType constants

type Parameter

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

Parameter is an implementation of the Parameter entity, which Allure uses as additional information describing the test Step (for example - request host or server address)

func NewParameter

func NewParameter(name string, value ...interface{}) *Parameter

NewParameter Constructor. Builds and returns a new `Parameter` object, using `name` as the parameter name and `value`, as the value.

func NewParameters

func NewParameters(kv ...interface{}) []*Parameter

NewParameters Constructor. Accepts a list of strings, separated by commas. Each even string is considered a parameter name, and each odd-value of the parameter. If an odd number of lines is passed, the last line is discarded. Returns the list of parameters received after processing the passed list.

func (*Parameter) GetValue

func (p *Parameter) GetValue() string

GetValue returns param value as string

type Result

type Result struct {
	Name          string        `json:"name,omitempty"`          // Test name
	FullName      string        `json:"fullName,omitempty"`      // Full path to the test
	Stage         string        `json:"stage,omitempty"`         // Stage of test execution
	Status        Status        `json:"status,omitempty"`        // Status of the test execution
	StatusDetails StatusDetail  `json:"statusDetails,omitempty"` // Details about the test (for example, errors during test execution will be recorded here)
	Start         int64         `json:"start,omitempty"`         // Start of test execution
	Stop          int64         `json:"stop,omitempty"`          // End of test execution
	UUID          uuid.UUID     `json:"uuid,omitempty"`          // Unique test ID
	HistoryID     string        `json:"historyId,omitempty"`     // ID in the allure history
	TestCaseID    string        `json:"testCaseId,omitempty"`    // ID of the test case (based on the hash of the full call)
	Description   string        `json:"description,omitempty"`   // Test description
	Attachments   []*Attachment `json:"attachments,omitempty"`   // Test case attachments
	Parameters    []*Parameter  `json:"parameters,omitempty"`    // Test case parameters
	Labels        []*Label      `json:"labels,omitempty"`        // Array of labels
	Links         []*Link       `json:"links,omitempty"`         // Array of references
	Steps         []*Step       `json:"steps,omitempty"`         // Array of steps
	ToPrint       bool          `json:"-"`                       // If false - the report will not be saved to a file
}

Result is an implementation of the Result entity used by Allure to store information about the test. It contains information about the test name, applications, description, status, references, labels, steps, containers, and time of the test execution.

func NewResult

func NewResult(testName, fullName string) *Result

NewResult Constructor Builds a new `allure.Result`. Sets the default values for the structure. ================================================ |Field Value| Default | ================================================ |UUID | random `uuid4` value | |Name | testName from args | |FullName | fullName from args | |TestCaseID | md5 hash of `Result.FullName` | |HistoryID | md5 hash from `Result.TestCaseID`| |Container | new empty `allure.Container` | |Labels | add new `allure.Language` label | |Start | allure.GetNow() | |ToPrint | `true` | ================================================ Sets the child for the container object.

func (*Result) AddLabel

func (result *Result) AddLabel(labels ...*Label)

AddLabel Adds all passed in arguments `allure.Label` to the report

func (*Result) Begin

func (result *Result) Begin() *Result

Begin Sets `Result.Start` as the current time

func (*Result) Done

func (result *Result) Done() error

Done Checks the status of the report. If `Result.Status` is not filled in, consider the test successfully completed (no errors). After that - it calls Finish() and Print() methods.

func (*Result) Finish

func (result *Result) Finish() *Result

Finish Sets `Result.Stop` as the current time

func (*Result) GetFirstLabel

func (result *Result) GetFirstLabel(labelType LabelType) (label *Label, ok bool)

GetFirstLabel returns first label in labels list and true if something have been found, return false if nothing was found

func (*Result) GetLabels

func (result *Result) GetLabels(labelType LabelType) []*Label

GetLabels Returns all `allure.Label` whose `LabelType` matches the one specified in the argument.

func (*Result) GetStatusMessage

func (result *Result) GetStatusMessage() string

func (*Result) GetStatusTrace

func (result *Result) GetStatusTrace() string

func (*Result) Print

func (result *Result) Print() error

Print If `Result.ToPrint` = `true` - the method terminates without creating any files. Otherwise:

  • Calls `Result.PrintAttachments()`.
  • Saves the file `uuid4-Result.json`.
  • Calls `Result.Container.Print()`
  • Returns error (if any)

func (*Result) PrintAttachments

func (result *Result) PrintAttachments()

PrintAttachments Goes through all `Result.Steps` of the report and for each allure.Step calls the `Step.PrintAttachments()` method. Then calls `Attachment.Print()` on all `allure.Attachment` of the `Result.Attachments` list.

func (*Result) ReplaceLabel

func (result *Result) ReplaceLabel(label *Label)

ReplaceLabel replaces label in the allure.Result object by label's name

func (*Result) ReplaceNewLabel

func (result *Result) ReplaceNewLabel(name LabelType, value string)

ReplaceNewLabel creates new label and replaces it in the allure.Result object by label's name

func (*Result) SetNewLabelMap

func (result *Result) SetNewLabelMap(kv map[LabelType]string)

SetNewLabelMap Adds all passed in arguments `allure.Label` to the report

func (*Result) SetStatusMessage

func (result *Result) SetStatusMessage(msg string)

func (*Result) SetStatusTrace

func (result *Result) SetStatusTrace(trace string)

func (*Result) SkipOnPrint

func (result *Result) SkipOnPrint()

SkipOnPrint Sets the `Result.ToPrint` variable to false.

func (*Result) ToJSON

func (result *Result) ToJSON() ([]byte, error)

ToJSON marshall allure.Result to json file

func (*Result) WithFrameWork

func (result *Result) WithFrameWork(framework string) *Result

WithFrameWork Adds `allure.Label` with type `Framework` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).

func (*Result) WithHost

func (result *Result) WithHost(hostName string) *Result

WithHost Adds `allure.Label` with type `Host` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).

func (*Result) WithLabels

func (result *Result) WithLabels(label ...*Label) *Result

WithLabels Adds an array of `allure.Label`. Returns a pointer to the current `allure.Result` (for Fluent Interface).

func (*Result) WithLanguage

func (result *Result) WithLanguage(language string) *Result

WithLanguage Adds `allure.Label` with type `Language` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).

func (*Result) WithLaunchTags

func (result *Result) WithLaunchTags() *Result

WithLaunchTags Adds all Launch Tags from the global variable `ALLURE_LAUNCH_TAGS` as labels with type `Tag` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).

func (*Result) WithPackage

func (result *Result) WithPackage(pkg string) *Result

WithPackage Adds `allure.Label` with type `Package` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).

func (*Result) WithParentSuite

func (result *Result) WithParentSuite(parentName string) *Result

WithParentSuite Adds `allure.Label` with type `Parent` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).

func (*Result) WithStage

func (result *Result) WithStage(stage string) *Result

WithStage sets Stage field to result Returns a pointer to the current `allure.Result` (for Fluent Interface).

func (*Result) WithSubSuites

func (result *Result) WithSubSuites(children ...string) *Result

WithSubSuites Adds `allure.Label` with type `SubSuite` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).

func (*Result) WithSuite

func (result *Result) WithSuite(suiteName string) *Result

WithSuite Adds `allure.Label` with type `Suite` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).

func (*Result) WithThread

func (result *Result) WithThread(thread string) *Result

WithThread Adds `allure.Label` with type `Thread` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).

type SeverityType

type SeverityType string
const (
	BLOCKER  SeverityType = "blocker"
	CRITICAL SeverityType = "critical"
	NORMAL   SeverityType = "normal"
	MINOR    SeverityType = "minor"
	TRIVIAL  SeverityType = "trivial"
)

SeverityType constants

func (SeverityType) ToString

func (s SeverityType) ToString() string

ToString casts SeverityType to string

type Status

type Status string

Status is Step's Status info

const (
	Passed  Status = "passed"
	Failed  Status = "failed"
	Skipped Status = "skipped"
	Broken  Status = "broken"
	Unknown Status = "unknown"
)

Status constants

type StatusDetail

type StatusDetail struct {
	Message string `json:"message"` // Abridged version of the message
	Trace   string `json:"trace"`   // Full message
}

StatusDetail ...

type Step

type Step struct {
	Name        string        `json:"name,omitempty"`
	Status      Status        `json:"status,omitempty"`
	Attachments []*Attachment `json:"attachments,omitempty"`
	Start       int64         `json:"start,omitempty"`
	Stop        int64         `json:"stop,omitempty"`
	Steps       []*Step       `json:"steps,omitempty"`
	Parameters  []*Parameter  `json:"parameters,omitempty"`
	// contains filtered or unexported fields
}

func NewSimpleStep

func NewSimpleStep(name string, parameters ...*Parameter) *Step

NewSimpleStep Constructor. Creates a `Step` object, by calling `allure.NewStep` with certain standard values (except for the Step name and possible parameters) ================================= | Field Value| Default | ================================= | status | `passed` | | start | `allure.GetNow()`| | stop | `allure.GetNow()`| | parameters | ...*Parameter | =================================

func NewStep

func NewStep(name string, status Status, start int64, stop int64, parameters []*Parameter) *Step

NewStep Constructor. Creates a new `allure.Step` object with field values passed in arguments and returns a pointer to it.

func (*Step) Begin

func (s *Step) Begin() *Step

Begin Puts `Step.Start` = `GetNow()`. Returns a pointer to the current Step (for Fluent Interface).

func (*Step) Broken

func (s *Step) Broken() *Step

Broken Puts `Step.Status` = `broken`. Returns a pointer to the current Step (for Fluent Interface).

func (*Step) Failed

func (s *Step) Failed() *Step

Failed Puts `Step.Status` = `failed`. Returns a pointer to the current Step (for Fluent Interface).

func (*Step) Finish

func (s *Step) Finish() *Step

Finish Puts `Step.Start` = `GetNow()`. Returns a pointer to the current Step (for Fluent Interface).

func (*Step) GetParent

func (s *Step) GetParent() *Step

GetParent returns step's parent

func (*Step) Passed

func (s *Step) Passed() *Step

Passed Puts `Step.Status` = `passed`. Returns a pointer to the current Step (for Fluent Interface).

func (*Step) PrintAttachments

func (s *Step) PrintAttachments()

PrintAttachments Goes through all `allure.Attachments` of the `Step.Attachments` array and calls `Print()` method on `allure.Attachment`.

func (*Step) Skipped

func (s *Step) Skipped() *Step

Skipped Puts `Step.Status` = `skipped`. Returns a pointer to the current Step (for Fluent Interface).

func (*Step) WithAttachments

func (s *Step) WithAttachments(attachments ...*Attachment) *Step

WithAttachments Adds to the array `Step.Attachments` passed in the argument `allure.Attachment`. Returns a pointer to the current Step (For Fluent Interface).

func (*Step) WithChild

func (s *Step) WithChild(child *Step) *Step

WithChild Sets the step `parentUUID` as the UUID for the step passed in the argument `child`. Returns a pointer to the current step (For Fluent Interface).

func (*Step) WithNewParameters

func (s *Step) WithNewParameters(kv ...interface{}) *Step

WithNewParameters Accepts a list of strings, separated by commas. Each even-numbered string is considered a parameter name, and each odd-numbered string is parameter value. If an odd number of lines is passed, the last line is discarded. Adds to the array `Step.Parameters` all `allure.Parameter` received after conversion `kv`. Returns pointer to the current Step (for Fluent Interface).

func (*Step) WithParameters

func (s *Step) WithParameters(params ...*Parameter) *Step

WithParameters Adds to the `Step.Parameters` array all `allure.Parameter` passed in the `params` argument. Returns a pointer to current Step (for Fluent Interface).

func (*Step) WithParent

func (s *Step) WithParent(parent *Step) *Step

WithParent Sets the step `parentUUID` as the UUID of the step passed in the argument `parent`. Returns a pointer to the current step (For Fluent Interface).

Jump to

Keyboard shortcuts

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