Documentation
¶
Index ¶
- Constants
- func GetNow() int64
- type Attachment
- type Container
- func (container *Container) AddChild(childUUID uuid.UUID)
- func (container *Container) Begin()
- func (container *Container) Done() error
- func (container *Container) Finish()
- func (container *Container) IsEmpty() bool
- func (container *Container) Print() error
- func (container *Container) PrintAttachments()
- func (container *Container) ToJSON() ([]byte, error)
- type FileManager
- type Label
- func EpicLabel(epic string) *Label
- func FeatureLabel(feature string) *Label
- func FrameWorkLabel(framework string) *Label
- func HostLabel(host string) *Label
- func IDAllureLabel(allureID string) *Label
- func IDLabel(testID string) *Label
- func LanguageLabel(language string) *Label
- func LayerLabel(layer string) *Label
- func LeadLabel(leadName string) *Label
- func NewLabel(labelType LabelType, value string) *Label
- func OwnerLabel(ownerName string) *Label
- func PackageLabel(packageName string) *Label
- func ParentSuiteLabel(parent string) *Label
- func SeverityLabel(severity SeverityType) *Label
- func StoryLabel(story string) *Label
- func SubSuiteLabel(subSuite string) *Label
- func SuiteLabel(suite string) *Label
- func TagLabel(tag string) *Label
- func TagLabels(tags ...string) []*Label
- func ThreadLabel(thread string) *Label
- type LabelType
- type Link
- type LinkTypes
- type MimeType
- type Parameter
- type Result
- func (result *Result) AddLabel(labels ...*Label)
- func (result *Result) Begin() *Result
- func (result *Result) Done() error
- func (result *Result) Finish() *Result
- func (result *Result) GetFirstLabel(labelType LabelType) (label *Label, ok bool)
- func (result *Result) GetLabels(labelType LabelType) []*Label
- func (result *Result) GetStatusMessage() string
- func (result *Result) GetStatusTrace() string
- func (result *Result) Print() error
- func (result *Result) PrintAttachments()
- func (result *Result) ReplaceLabel(label *Label)
- func (result *Result) ReplaceNewLabel(name LabelType, value string)
- func (result *Result) SetNewLabelMap(kv map[LabelType]string)
- func (result *Result) SetStatusMessage(msg string)
- func (result *Result) SetStatusTrace(trace string)
- func (result *Result) SkipOnPrint()
- func (result *Result) ToJSON() ([]byte, error)
- func (result *Result) WithFrameWork(framework string) *Result
- func (result *Result) WithHost(hostName string) *Result
- func (result *Result) WithLabels(label ...*Label) *Result
- func (result *Result) WithLanguage(language string) *Result
- func (result *Result) WithLaunchTags() *Result
- func (result *Result) WithPackage(pkg string) *Result
- func (result *Result) WithParentSuite(parentName string) *Result
- func (result *Result) WithStage(stage string) *Result
- func (result *Result) WithSubSuites(children ...string) *Result
- func (result *Result) WithSuite(suiteName string) *Result
- func (result *Result) WithThread(thread string) *Result
- type SeverityType
- type Status
- type StatusDetail
- type Step
- func (s *Step) Begin() *Step
- func (s *Step) Broken() *Step
- func (s *Step) Failed() *Step
- func (s *Step) Finish() *Step
- func (s *Step) GetParent() *Step
- func (s *Step) Passed() *Step
- func (s *Step) PrintAttachments()
- func (s *Step) Skipped() *Step
- func (s *Step) WithAttachments(attachments ...*Attachment) *Step
- func (s *Step) WithChild(child *Step) *Step
- func (s *Step) WithNewParameters(kv ...interface{}) *Step
- func (s *Step) WithParameters(params ...*Parameter) *Step
- func (s *Step) WithParent(parent *Step) *Step
Constants ¶
const (
// DefaultVersion - allure-go current Version
DefaultVersion = "Allure-Go@v0.6.0"
)
Variables ¶
This section is empty.
Functions ¶
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) Begin ¶
func (container *Container) Begin()
Begin Sets `Container.Start` = allure.GetNow()
func (*Container) Finish ¶
func (container *Container) Finish()
Finish Sets Container.Stop = allure.GetNow()
func (*Container) IsEmpty ¶
IsEmpty Returns `true` if arrays Container.Befores and Container.Afters are empty.
func (*Container) Print ¶
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
- Call Container.PrintAttachments()
- Serializes the file into `uuid4-container.json`.
- 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.
type FileManager ¶
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 FrameWorkLabel ¶
FrameWorkLabel returns Framework Label
func IDAllureLabel ¶
IDAllureLabel returns AllureID Label
func LanguageLabel ¶
LanguageLabel returns Language Label
func NewLabel ¶
NewLabel - builds and returns a new allure.Label. The label key depends on the passed LabelType.
func ParentSuiteLabel ¶
ParentSuiteLabel returns ParentSuite Label
func SeverityLabel ¶
func SeverityLabel(severity SeverityType) *Label
SeverityLabel returns Severity Label
func SubSuiteLabel ¶
SubSuiteLabel returns SubSuite Label
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
type Link ¶
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 TestCaseLink ¶
TestCaseLink returns TESTCASE type link
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 ¶
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.
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 ¶
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) Done ¶
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) GetFirstLabel ¶
GetFirstLabel returns first label in labels list and true if something have been found, return false if nothing was found
func (*Result) GetLabels ¶
GetLabels Returns all `allure.Label` whose `LabelType` matches the one specified in the argument.
func (*Result) GetStatusMessage ¶
func (*Result) GetStatusTrace ¶
func (*Result) Print ¶
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 ¶
ReplaceLabel replaces label in the allure.Result object by label's name
func (*Result) ReplaceNewLabel ¶
ReplaceNewLabel creates new label and replaces it in the allure.Result object by label's name
func (*Result) SetNewLabelMap ¶
SetNewLabelMap Adds all passed in arguments `allure.Label` to the report
func (*Result) SetStatusMessage ¶
func (*Result) SetStatusTrace ¶
func (*Result) SkipOnPrint ¶
func (result *Result) SkipOnPrint()
SkipOnPrint Sets the `Result.ToPrint` variable to false.
func (*Result) WithFrameWork ¶
WithFrameWork Adds `allure.Label` with type `Framework` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).
func (*Result) WithHost ¶
WithHost Adds `allure.Label` with type `Host` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).
func (*Result) WithLabels ¶
WithLabels Adds an array of `allure.Label`. Returns a pointer to the current `allure.Result` (for Fluent Interface).
func (*Result) WithLanguage ¶
WithLanguage Adds `allure.Label` with type `Language` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).
func (*Result) WithLaunchTags ¶
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 ¶
WithPackage Adds `allure.Label` with type `Package` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).
func (*Result) WithParentSuite ¶
WithParentSuite Adds `allure.Label` with type `Parent` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).
func (*Result) WithStage ¶
WithStage sets Stage field to result Returns a pointer to the current `allure.Result` (for Fluent Interface).
func (*Result) WithSubSuites ¶
WithSubSuites Adds `allure.Label` with type `SubSuite` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).
func (*Result) WithSuite ¶
WithSuite Adds `allure.Label` with type `Suite` to the report. Returns a pointer to the current `allure.Result` (for Fluent Interface).
func (*Result) WithThread ¶
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 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 ¶
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 ¶
NewStep Constructor. Creates a new `allure.Step` object with field values passed in arguments and returns a pointer to it.
func (*Step) Begin ¶
Begin Puts `Step.Start` = `GetNow()`. Returns a pointer to the current Step (for Fluent Interface).
func (*Step) Broken ¶
Broken Puts `Step.Status` = `broken`. Returns a pointer to the current Step (for Fluent Interface).
func (*Step) Failed ¶
Failed Puts `Step.Status` = `failed`. Returns a pointer to the current Step (for Fluent Interface).
func (*Step) Finish ¶
Finish Puts `Step.Start` = `GetNow()`. Returns a pointer to the current Step (for Fluent Interface).
func (*Step) Passed ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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).