Start starts the given test suite and executes all tests
(tests []TestCase)
| 133 | |
| 134 | // Start starts the given test suite and executes all tests |
| 135 | func (r *Runtime) Start(tests []TestCase) Result { |
| 136 | // Sort tests alphabetically to preserve a reproducible execution order |
| 137 | sort.SliceStable(tests, func(i, j int) bool { |
| 138 | return tests[i].Title < tests[j].Title |
| 139 | }) |
| 140 | |
| 141 | result := Result{} |
| 142 | testCh := r.Runner.Run(tests) |
| 143 | start := time.Now() |
| 144 | for tr := range testCh { |
| 145 | if tr.Skipped { |
| 146 | result.Skipped++ |
| 147 | |
| 148 | log.Println("title: '"+tr.TestCase.Title+"'", " was skipped") |
| 149 | log.Println("title: '"+tr.TestCase.Title+"'", " Command: ", tr.TestCase.Command.Cmd) |
| 150 | log.Println("title: '"+tr.TestCase.Title+"'", " Directory: ", tr.TestCase.Command.Dir) |
| 151 | log.Println("title: '"+tr.TestCase.Title+"'", " Env: ", tr.TestCase.Command.Env) |
| 152 | |
| 153 | r.EventHandler.TestSkipped(tr) |
| 154 | result.TestResults = append(result.TestResults, tr) |
| 155 | continue |
| 156 | } |
| 157 | |
| 158 | if !tr.ValidationResult.Success { |
| 159 | result.Failed++ |
| 160 | } |
| 161 | |
| 162 | r.EventHandler.TestFinished(tr) |
| 163 | result.TestResults = append(result.TestResults, tr) |
| 164 | } |
| 165 | result.Duration = time.Since(start) |
| 166 | |
| 167 | return result |
| 168 | } |