Closed mgwidmann closed 7 years ago
@shdblowers any comments?
From what I can see it looks like you're trying to implement ExUnit.Case tags but I don't think its being done in the right way.
As I understand it, tags are used to pass data from a specific unit test to the setup
callback which is used by all tests in that module.
So, converted into Gherkin usage, they would look like this (taken from example in link above):
defmodule FeatureTest do
use Cabbage.Feature, file: "feature.feature"
setup context do
# Read the :cd tag value
if cd = context[:cd] do
prev_cd = File.cwd!
File.cd!(cd)
on_exit fn -> File.cd!(prev_cd) end
end
:ok
end
# ...
# ...
end
Feature: Some feature that needs to change working directory
@tag cd: "another_dir"
Scenario: Something with CWD
Given something
When something else
Then expected thing happened
Is that what is trying to be achieved @mgwidmann ?
I'm also wondering what the use case is for this as you can have as many setup steps as you need, i.e.
Given ...
And ...
And ...
Adding in these tags to do setup just adds unnecessary complexity and makes it harder for a non-technical person to read
When I've worked with tags in cucumber before its always been a way of adding a before/after hook to multiple scenarios, thats what I was going for. It may be lesser needed functionality given you can just put the setup/2
calls in your elixir feature module to perform the same task. I haven't seen where the Gherkin syntax supports any arguments within the .feature
file...
OK, I am confusing ExUnit tags with Gherkin tags
This issue was causing the tests to fail... https://github.com/cabbage-ex/gherkin/issues/4
Pushed v0.2.2
with this feature!
@meadsteve This adds the use of tags for each scenario. It does so by adding an
ExUnit.setup/2
call to process each tag.The tests are still failing but I'm fairly certain its almost there.