cabbage-ex / cabbage

Story BDD tool for executing elixir in ExUnit
MIT License
144 stars 34 forks source link

Scenarios should be grouped by feature #73

Open hauleth opened 5 years ago

hauleth commented 5 years ago

Feature should be translated to describe and Scenario to test.

revati commented 5 years ago

Currently, each Scenario is wrapped in separate describe. Don't know exactly what was initial intent, but what you are asking seems doable.

Except: as of gherkin 6 there is a new concept: Rule which brings one more layer of depth.

While it seems doable, what benefit would it have? In the final output, each scenario should be a test, everything outside that is open for change.

One more case, would be, that there always is only one Feature, can there even be two Features in one Scenario?

hauleth commented 5 years ago

Pros:

  1. It will have more descriptive name in case of test failures and/or issues, currently it is feature Scenario name Scenario name (so you see that Scenario name is repeated).
  2. You will need to translate background to setup only once, as setups are shared among all tests in describe.
  3. You cannot have multiple Feature in Scenario, but you can have multiple Feature in single file and multiple Scenarios in single Feature.
revati commented 5 years ago
  1. Naming can and should be fixed regardless of describe and test hierarchy.
  2. it can be done in global scope as well. describe isn't a requirement for that.
  3. If that (one can have multiple Features in single *.feature file) is true, it is odd. Even then have them wrapped around in describe isn't a requirement.

Currently, it seems for me it there are 2 possible ways regarding describe

Dunno. In either case, it isn't neither a primary concern, nor one that somehow drastically would change how lib interacts with end user (developer).

hauleth commented 5 years ago

@revati if you have multiple Feature within single file, and then you implement setup for Background then these two will collide as both setups will run. Alternative is that describe would be used for each Rule and we would disallow multiple Features per file.

revati commented 5 years ago

I'm more inclined towards seconds option, as it would provide better integration with Rule and disallow multiple Features in single file.

Is it possible to create some sort of poll in github? 😅

hauleth commented 5 years ago

No other way than "emoji voting".

mononym commented 5 years ago

Cucumber doesn't even support multiple features in a single file: https://stackoverflow.com/questions/30599752/multiple-feature-inside-single-feature-file

I don't think that should be something to worry about. Either the things in the single file being tested are so closely related that they are part of the same feature, or they are separate enough that they deserve their own feature files. This seems to be the philosophy they are following.