diff --git a/pkg/allure/result.go b/pkg/allure/result.go index f2e7f4f..19c42fc 100644 --- a/pkg/allure/result.go +++ b/pkg/allure/result.go @@ -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 @@ -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 { diff --git a/pkg/framework/core/allure_manager/manager/description.go b/pkg/framework/core/allure_manager/manager/description.go index 70f9ae2..116ecbf 100644 --- a/pkg/framework/core/allure_manager/manager/description.go +++ b/pkg/framework/core/allure_manager/manager/description.go @@ -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...) + }) +} diff --git a/pkg/framework/provider/allure.go b/pkg/framework/provider/allure.go index 9b2ca4d..8513df1 100644 --- a/pkg/framework/provider/allure.go +++ b/pkg/framework/provider/allure.go @@ -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 {