Giter Site home page Giter Site logo

Comments (2)

vladimirvivien avatar vladimirvivien commented on August 9, 2024

@harshanarayana Thanks for bringing that up.

Right now the api supports very specific sets of steps

  • Assessment
  • Setup
  • Teardown
  • (might be one more)

Some of the pre-baked steps above do have auto-generate names (except Assessment). This is because the internal method FeatureBuilder.WithStep requires a name. The reason WithStep is hidden is because each step type, specified by Level (i.e. Assess, Setup, Teardown, etc) are treated differently during execution.

Maybe, one thing that can be done is to extend the Feature API to allow Setup and Teardown to have names as well as shown below:

func TestHello_WithSetup(t *testing.T) {
	e := env.NewWithConfig(envconf.New())
	var name string
	feat := features.New("Hello Feature").
		WithLabel("type", "simple").
		WithSetup("SetupName", func(ctx context.Context, t *testing.T, _ *envconf.Config) context.Context {
			name = "foobar"
			return ctx
		}).
		Assess("test message", func(ctx context.Context, t *testing.T, _ *envconf.Config) context.Context {
			result := Hello(name)
			if result != "Hello foobar" {
				t.Error("unexpected message")
			}
			return ctx
		}).WithTeardown("Teardown", func(ctx context.Context, t *testing.T, _ *envconf.Config) context.Context {
                ...
		}).Feature()

	e.Test(t, feat)
}

from e2e-framework.

harshanarayana avatar harshanarayana commented on August 9, 2024

@vladimirvivien I see what you mean.
I do like the idea of extending the feature API to provide additional option to be able to provide step names. Makes it a bit more readable and easy to debug. Let me have a Draft PR opened on this for review.

from e2e-framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.