cabbage-ex / cabbage

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

Allow use of alternative TestCase #3

Closed rawkode closed 7 years ago

rawkode commented 7 years ago

Hey,

This seems pretty awesome! Instead of injecting use ExUnit into all generated tests, can we provide an alternative module through the keyword list?

Awesome job with this :+1:

mgwidmann commented 7 years ago

Yeah I don't see why not, its not a huge lift to make it configurable. Would something like this in your config/test.exs work?

config :cabbage,
  ex_unit_module: MyAwesomeTestingFramework

And then we will just pass along anything you give to it?

The only restriction is that it must be based upon ExUnit since we override the test macro from there, frameworks based upon others would be more difficult to support (I'm not personally aware of any major competitors at the moment).

rawkode commented 7 years ago

I think it may be better to pass through at the top of the module, so we can pass through ConnTest for controller tests and ChannelTest for channels, etc.

mgwidmann commented 7 years ago

That makes sense to support case templates. so like this?

defmodule MyTest do
  use Cabbage.Feature, use: ConnTest, feature: "my_feature.feature", other_opts: [:a, :b, :c]
end

and then we'll just do opts[:use] || ExUnit.Case right?

rawkode commented 7 years ago

Sounds good to me! If I can help in anyway, let me know 😃