Skip to content

Commit 0fb668c

Browse files
Skipped property allows you to skip a step (#70)
1 parent 05b60b1 commit 0fb668c

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ This is useful when you have asynchronous API and allows waiting before calling
262262
|--- |---
263263
|**step_type** | `pause`
264264
|**duration** | Number of seconds to wait.
265+
|**skipped** | If true the step is skipped and nothing is running.
265266

266267
**Example:** _Wait for 5 seconds_
267268
<details open>
@@ -296,6 +297,7 @@ This is useful when you have asynchronous API and allows waiting before calling
296297
|**variables** | Array of variables to extract from the response _([see Using Variables to Pass Data Between Steps for details](#))_
297298
|**headers** | Object who contains all the headers attach to the request _([see how to add headers](#headers))_
298299
|**assertions** | Array of assertions, this is the acceptance tests _([see how to create assertion tests](#assertions))_
300+
|**skipped** | If true the step is skipped and nothing is running.
299301

300302
### Headers
301303
Headers are represented by an object containing all the headers to send.

pkg/controller/scenario_ctrl.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ func (s *scenarioControllerImpl) Run(scenario model.Scenario) model.ScenarioResu
3131
logrus.Infof("%s\n", scenario.Description)
3232

3333
for _, step := range scenario.Steps {
34+
if step.Skipped {
35+
logrus.Error("step is skipped")
36+
continue
37+
}
38+
3439
stepRes, err := s.stepController.Run(step)
3540
if err != nil {
3641
logrus.Errorf("impossible to execute the step: %v\n%v", err, step)

pkg/model/step.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ type Step struct {
1010
Method string `json:"method,omitempty"`
1111
Duration int `json:"duration,omitempty"`
1212
Body string `json:"body,omitempty"`
13+
Skipped bool `json:"skipped,omitempty"`
1314
}

testdata/scenario_valid_yaml.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ steps:
1717
assertions:
1818
- comparison: equal_number
1919
value: '200'
20-
source: response_status
20+
source: response_status

0 commit comments

Comments
 (0)