cabbage-ex / cabbage

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

Add cabbage mix tasks #35

Closed gmile closed 6 years ago

gmile commented 7 years ago

I think it'd be great to have a cabbage mix task to tasks, tailored to features.

mgwidmann commented 7 years ago

So the current plan is to lean on ex unit to do that for you... Perhaps the readme could use some love but this is how it works today:

mix test path/to/feature.exs or mix test --only integration

I guess we could add tasks that basically did the same thing if that would be helpful since I know running the exs file isn't the most intuitive...

mgwidmann commented 7 years ago

The #34 PR will give the ability to do the following:

Feature: Run just one test
  @any-made-up-tag-you-want
  Scenario: Targeting specific tests
    Given there is a test I wish to run
    When I execute "mix test --only any-made-up-tag-you-want"
    Then only this test is run

  Scenario: Another test
    Given this a test that should not run
    When I execute "mix test --only any-made-up-tag-you-want"
    Then this test does not run

Also, given that the exs version of that feature file is in test/tag_test.exs, you could run each specific test like: First scenario mix test test/tag_test.exs:3 Second scenario mix test test/tag_test.exs:8

Lastly it will allow a timeout value to be set in ExUnit by doing

Feature: Run just one test
  # Has double the standard test timeout of 60 seconds
  @timeout 120000
  Scenario: Targeting specific tests
    Given there is a test I wish to run
    When I execute "mix test --only any-made-up-tag-you-want"
    Then only this test is run
zedtux commented 7 years ago

Is it possible to get mix test running all the tests, including the cabbage tests?

revati commented 6 years ago

Yes, currently works like that.

mix test <- runs all tests.

If you want to run only cabbage tests, set global tag for all cabbage tests via config.


 config :cabbage,
   # Default is []
   global_tags: :cabbage

`mix test --only=cabbage` <- will only run cabbage tests