Expose collection of defined Tests for individual function test execution so that boiler plate code can be added around execution of test.
Example:
func TestMain(m *testing.M) {
setupAll()
for t, _ := range m.Tests {
setup(t)
result := t.Run()
if result.Passed {
// handle passed test, discard resources etc
}
if result.Failed {
// example scenario - forward log for immediate notification/action
// preserve/copy resources for troubleshooting inspection.
}
teardown(t)
}
teardownAll()
os.Exit(code)
}