@@ -8,14 +8,15 @@ import (
8
8
)
9
9
10
10
type stepObject struct {
11
- Name string `json:"name,omitempty"`
12
- Status string `json:"status,omitempty"`
13
- Stage string `json:"stage"`
14
- ChildrenSteps []stepObject `json:"steps"`
15
- Attachments []attachment `json:"attachments"`
16
- Parameters []Parameter `json:"parameters"`
17
- Start int64 `json:"start"`
18
- Stop int64 `json:"stop"`
11
+ Name string `json:"name,omitempty"`
12
+ Status string `json:"status,omitempty"`
13
+ StatusDetail statusDetails `json:"statusDetails,omitempty"`
14
+ Stage string `json:"stage"`
15
+ ChildrenSteps []stepObject `json:"steps"`
16
+ Attachments []attachment `json:"attachments"`
17
+ Parameters []Parameter `json:"parameters"`
18
+ Start int64 `json:"start"`
19
+ Stop int64 `json:"stop"`
19
20
}
20
21
21
22
func (s * stepObject ) GetSteps () []stepObject {
@@ -39,6 +40,12 @@ func Step(description string, action func()) {
39
40
StepWithParameter (description , nil , action )
40
41
}
41
42
43
+ // SkipStep doesn't execute the action and marks the step as skipped in report
44
+ // Reason won't appear in report until https://github.com/allure-framework/allure2/issues/774 is fixed
45
+ func SkipStep (description , reason string , action func ()) {
46
+ SkipStepWithParameter (description , reason , nil , action )
47
+ }
48
+
42
49
// StepWithParameter is meant to be wrapped around actions with the purpose of logging the parameters
43
50
func StepWithParameter (description string , parameters map [string ]interface {}, action func ()) {
44
51
step := newStep ()
@@ -69,6 +76,26 @@ func StepWithParameter(description string, parameters map[string]interface{}, ac
69
76
step .Status = "passed"
70
77
}
71
78
79
+ // SkipStepWithParameter doesn't execute the action and marks the step as skipped in report
80
+ // Reason won't appear in report until https://github.com/allure-framework/allure2/issues/774 is fixed
81
+ func SkipStepWithParameter (description , reason string , parameters map [string ]interface {}, action func ()) {
82
+ step := newStep ()
83
+ step .Start = getTimestampMs ()
84
+ step .Name = description
85
+ if parameters == nil || len (parameters ) > 0 {
86
+ step .Parameters = convertMapToParameters (parameters )
87
+ }
88
+ step .Status = "skipped"
89
+ step .StatusDetail .Message = reason
90
+ if currentStepObj , ok := ctxMgr .GetValue (nodeKey ); ok {
91
+ currentStep := currentStepObj .(hasSteps )
92
+ currentStep .AddStep (* step )
93
+ } else {
94
+ log .Fatalln ("could not retrieve current allure node" )
95
+ }
96
+ step .Stop = getTimestampMs ()
97
+ }
98
+
72
99
func newStep () * stepObject {
73
100
return & stepObject {
74
101
Attachments : make ([]attachment , 0 ),
0 commit comments