Skip to content

Commit

Permalink
Merge pull request #61 from ozontech/release/issue-60
Browse files Browse the repository at this point in the history
Release/issue 60
  • Loading branch information
koodeex authored Mar 22, 2023
2 parents 126f276 + 7cf98c8 commit f54f329
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/allure/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
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
Expand Down Expand Up @@ -118,6 +119,13 @@ func (result *Result) SetNewLabelMap(kv map[LabelType]string) {
result.AddLabel(labels...)
}

// WithStage sets Stage field to result
// Returns a pointer to the current `allure.Result` (for Fluent Interface).
func (result *Result) WithStage(stage string) *Result {
result.Stage = stage
return result
}

// WithParentSuite Adds `allure.Label` with type `Parent` to the report.
// Returns a pointer to the current `allure.Result` (for Fluent Interface).
func (result *Result) WithParentSuite(parentName string) *Result {
Expand Down
14 changes: 14 additions & 0 deletions pkg/framework/core/allure_manager/manager/description.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,17 @@ func (a *allureManager) Descriptionf(format string, args ...interface{}) {
result.Description = fmt.Sprintf(format, args...)
})
}

// Stage provides staqe to test result(using fmt.Sprint)
func (a *allureManager) Stage(args ...interface{}) {
a.safely(func(result *allure.Result) {
result.Stage = fmt.Sprint(args...)
})
}

// Stagef provides staqe to test result(using fmt.Sprintf)
func (a *allureManager) Stagef(format string, args ...interface{}) {
a.safely(func(result *allure.Result) {
result.Stage = fmt.Sprintf(format, args...)
})
}
2 changes: 2 additions & 0 deletions pkg/framework/provider/allure.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ type DescriptionFields interface {
Titlef(format string, args ...interface{})
Description(args ...interface{})
Descriptionf(format string, args ...interface{})
Stage(args ...interface{})
Stagef(format string, args ...interface{})
}

type AllureSteps interface {
Expand Down

0 comments on commit f54f329

Please sign in to comment.