Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support more than three stages #58

Open
janschaefer opened this issue Oct 1, 2016 · 3 comments
Open

Support more than three stages #58

janschaefer opened this issue Oct 1, 2016 · 3 comments

Comments

@janschaefer
Copy link
Member

There should be a way of dynamically add additional stages to a scenario so that one is not limited to three stages

@flegall
Copy link
Member

flegall commented Oct 1, 2016

I'm not sure I exactly understand this.
Do you mean being able to define multiple stages (because they have different concerns) and being able to use steps coming from those different stages ?

If yes, I think it's possible already using javascript mixins, and even benefit from type-safety by using type intersections in both flowtype & typescript.

@janschaefer
Copy link
Member Author

Ok. Maybe I have not completely understand your implementation. It seems that you could only use at most three stages in a single scenario. In JGiven you can have additional stages by injecting them into the test class using the @ScenarioStage annotation.

@flegall
Copy link
Member

flegall commented Oct 2, 2016

The scenarios() method takes as second argument a StagesParam<G, W, T> :
Which can either be a 3 class tuple or a Class<G & W & T>
type StagesParam<G, W, T> = [Class<G>, Class<W>, Class<T>] | Class<G & W & T>;

That mean that you can pass either:

  • 3 different stages that gets returned when calling given(), when() or then() in scenarios
  • or a single stage that gets returned when calling any of these methods.

I understand now what you mean: @ScenarioStage can be used:

  1. to inject additional stages in the test class
  2. within stages to inject other stages.

It's nicer than using javascript mixins to merge stages.

So, it's not possible yet in jsgiven.
Let's think of a solution now even if we don't implement it, because so far nobody uses jsgiven, therefore we can still make breaking changes to the core API.

@flegall flegall removed the question label Oct 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants