MCPcopy Create free account
hub / github.com/commander-cli/commander / Start

Method Start

pkg/runtime/runtime.go:135–168  ·  view source on GitHub ↗

Start starts the given test suite and executes all tests

(tests []TestCase)

Source from the content-addressed store, hash-verified

133
134// Start starts the given test suite and executes all tests
135func (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}

Callers 6

executeFunction · 0.95
Test_AlphabeticalOrderFunction · 0.95
Test_RuntimeStartFunction · 0.80
TestRuntime_WithRetriesFunction · 0.80
Test_RuntimeWithSkipFunction · 0.80

Calls 1

RunMethod · 0.80

Tested by 5

Test_AlphabeticalOrderFunction · 0.76
Test_RuntimeStartFunction · 0.64
TestRuntime_WithRetriesFunction · 0.64
Test_RuntimeWithSkipFunction · 0.64