feat: support nested testcase in teststep

This commit is contained in:
debugtalk
2021-09-20 10:59:37 +08:00
parent f4874c525f
commit c29f85bc64
3 changed files with 31 additions and 0 deletions

29
testcase.go Normal file
View File

@@ -0,0 +1,29 @@
package httpboomer
func RunTestCase(name string) *TestCase {
return &TestCase{
Config: TConfig{
Name: name,
},
}
}
func (tc *TestCase) WithVariables(variables Variables) *TestCase {
tc.Config.Variables = variables
return tc
}
func (tc *TestCase) ToStruct() *TStep {
return &TStep{
TestCase: tc,
}
}
func (tc *TestCase) Run() error {
for _, step := range tc.TestSteps {
if err := step.Run(); err != nil {
return err
}
}
return nil
}