Closed Gorgy33 closed 2 years ago
Hmm, there is a proposal:
func (s *MySuite) TestSomeTest(t provider.T) {
var (
v1 string
v2 int
ctx context.Context
)
t.WithTestSetup(func (t provider.T) {
// all here will be in Set up section in allure report
t.WithNewStep("Init v1", func(sCtx, StepCtx) {
v1 = "SomeString"
sCtx.WithParams("v1", v1)
}
t.WithNewStep("Init v2", func(sCtx, StepCtx) {
v2 = 123
sCtx.WithParams("v2", v2)
}
t.WithNewStep("Init ctx", func(sCtx, StepCtx) {
ctx = context.Background()
sCtx.WithParams("ctx", ctx)
}
})
defer t.WithTestTearDown(func (t provider.T) {
// all here will be in Tear down section in allure report
t.WithNewStep("close ctx", func(sCtx, StepCtx) {
ctx.Done()
sCtx.WithParams("ctx", ctx)
}
})
// ...
}
Is your feature request related to a problem? Please describe. Now days all test setup steps logged in test steps block
Describe the solution you'd like I want something like
WithTestSetup
method in provider.T interface for logging into preconditions block