-
Notifications
You must be signed in to change notification settings - Fork 33
/
parameters_test.go
67 lines (54 loc) · 1.64 KB
/
parameters_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
65
66
67
//go:build examples_new
// +build examples_new
package suite_demo
import (
"testing"
"github.com/ozontech/allure-go/pkg/allure"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
)
type ParametersDemoSuite struct {
suite.Suite
}
func (s *ParametersDemoSuite) TestAddParameterToStep(t provider.T) {
t.Epic("Demo")
t.Feature("Parameters")
t.Title("Add Parameters to step")
t.Description(`
Step A will contain following parameters:
Param1 = Val1
Param2 = Val2
Param3 = Val3
Param4 = Val4
Param5 = Val5
Param6 = Val6
Param7 = Val7`)
t.Tags("Steps", "Nesting", "Parameters")
step := allure.NewSimpleStep("Step A")
// with step.WithParameters(s) function
step.WithParameters(allure.NewParameter("Param1", "Val1"))
step.WithParameters(allure.NewParameters("Param2", "Val2", "Param3", "Val3", "Param4", "Val4")...)
// don't forget register your step :)
t.Step(step)
}
func (s *ParametersDemoSuite) TestAddParameterToNestedStep(t provider.T) {
t.Epic("Demo")
t.Feature("Parameters")
t.Title("Add parameters to Nested Steps")
t.Description(`
Step A is parent step for Step B
Step A contains Param 1 and Param 4
Step B contains Param 2 and Param 3`)
t.Tags("Steps", "Nesting", "Parameters")
t.WithNewStep("Step A", func(ctx provider.StepCtx) {
ctx.WithNewParameters("Param 1", "Value 1")
ctx.WithNewStep("Step B", func(ctx provider.StepCtx) {
ctx.WithNewParameters("Param 2", "Value 2", "Param 3", "Value 3")
})
ctx.WithNewParameters("Param 4", "Value 3")
})
}
func TestParameters(t *testing.T) {
t.Parallel()
suite.RunSuite(t, new(ParametersDemoSuite))
}