e2e-framework
e2e-framework copied to clipboard
Allow execution of non-feature tests
Support the execution of tests without requiring use of the features package.
To the Environment interface, I propose the addition of two new functions:
type Environment interface {
RunTest(ctx context.Context, t *testing.T, cfg *envconf.Config) bool
RunBenchmark(ctx context.Context, b *testing.B, cfg *envconf.Config) bool
}
I am unsure what if anything makes sense as return values, t.Run returns a bool which may fit here; additionally RunBenchmark
might deserve its own issue, given the current lack of support overall for benchmarks.
Note, there is some overlap in wording with this existing function, unsure if the above naming will be confusing:
// Run Launches the test suite from within a TestMain
Run(*testing.M) int
The goal is to allow a more stream-lined path to writing go tests natively or otherwise with the framework of choice; don't force usage of the features package.
Potential usage:
testenv.RunTest(ctx context.Context, t *testing.T, cfg *envconf.Config) (context.Context, error){
...
if err != nil {
t.Fatal(err)
}
...
t.Run("...", func(t testing.T){
t.Parallel()
...
})
})