-
Notifications
You must be signed in to change notification settings - Fork 33
/
step_tree_test.go
64 lines (53 loc) · 1.43 KB
/
step_tree_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//go:build examples_new
// +build examples_new
package suite_demo
import (
"testing"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)
type StepTreeDemoSuite struct {
suite.Suite
}
func (s *StepTreeDemoSuite) TestInnerSteps(t provider.T) {
t.Epic("Demo")
t.Feature("Inner Steps")
t.Title("Simple Nesting")
t.Description(`
Step A is parent step for Step B and Step C
Call order will be saved in allure report
A -> (B, C)`)
t.Tags("Steps", "Nesting")
t.WithNewStep("Step A", func(ctx provider.StepCtx) {
ctx.NewStep("Step B")
ctx.NewStep("Step C")
})
}
func (s *StepTreeDemoSuite) TestComplexStepTree(t provider.T) {
t.Epic("Demo")
t.Feature("Inner Steps")
t.Title("Complex Nesting")
t.Description(`
Step A is parent for Step B, Step C and Step F
Step C is parent for Step D and Step E
Step F is parent for Step G and Step H
Call order will be saved in allure report
A -> (B, C -> (D, E), F -> (G, H), I)`)
t.Tags("Steps", "Nesting")
t.WithNewStep("Step A", func(ctx provider.StepCtx) {
ctx.NewStep("Step B")
ctx.WithNewStep("Step C", func(ctx provider.StepCtx) {
ctx.NewStep("Step D")
ctx.NewStep("Step E")
})
ctx.WithNewStep("Step F", func(ctx provider.StepCtx) {
ctx.NewStep("Step G")
ctx.NewStep("Step H")
})
ctx.NewStep("Step I")
})
}
func TestStepTree(t *testing.T) {
t.Parallel()
suite.RunSuite(t, new(StepTreeDemoSuite))
}