feat: run referenced testcase

This commit is contained in:
debugtalk
2021-09-23 11:59:52 +08:00
parent c2effd3f75
commit cad10bc8b6
2 changed files with 13 additions and 4 deletions

View File

@@ -36,9 +36,18 @@ func (r *Runner) runCase(testcase *TestCase) error {
config := &testcase.Config
log.Printf("Start to run testcase: %v", config.Name)
for _, step := range testcase.TestSteps {
tStep := parseStep(step, config)
if err := r.runStep(tStep); err != nil {
return err
if tc, ok := step.(*testcaseWithOptionalArgs); ok {
// run referenced testcase
log.Printf("run referenced testcase: %v", tc.step.Name)
if err := r.runCase(tc.step.TestCase); err != nil {
return err
}
} else {
// run request
tStep := parseStep(step, config)
if err := r.runStep(tStep); err != nil {
return err
}
}
}
return nil