Skip to content

proposal: testing: add support for individual test function execution - expose testing.M.Tests #53701

Description

@mattdbush

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)
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions