ScenarioContext.Current.ScenarioInfo.Tags doesn't contain 'feature' tags

700 views
Skip to first unread message

Alister Scott

unread,
Feb 12, 2013, 1:45:15 AM2/12/13
to spec...@googlegroups.com
Hi,

I am using ScenarioContext.Current.ScenarioInfo.Tags in hooks, and when my feature contains an @tag, this collection of tags is empty.
When I put the @tag at the scenario level, it is accessible.

Is this a specflow bug?

Alister

@doesntwork
Feature: Blah

@works
Scenario: Yay


Borislav Traykov

unread,
Feb 14, 2013, 6:45:57 AM2/14/13
to SpecFlow
Hi Alister,

Even though Cucumber states that feature tags are inherited by each
scenario in that feature, we've discovered that in SpecFlow "feature"
and "scenario" are two different contexts, thus (in version 1.9 at
least) there are

- the ScenarioContext class, hence
ScenarioContext.Current.ScenarioInfo.Tags
- the FeatureContext class, hence
FeatureContext.Current.FeatureInfo.Tags

Whenever I need to look up a tag, I do so in both contexts.
Haven't checked if this is a bug or an implementation detail of
SpecFlow.

Hope this helps,
Borislav

Alister Scott

unread,
Feb 14, 2013, 7:53:31 AM2/14/13
to spec...@googlegroups.com
Thanks Borislav. That makes sense. I'll update my hooks to check both.

Cheers,
Alister
> --
> You received this message because you are subscribed to the Google Groups "SpecFlow" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to specflow+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Oliver Friedrich

unread,
Feb 14, 2013, 8:15:30 AM2/14/13
to spec...@googlegroups.com
Wow, thanks for that insight, Borislav. I wasn't even aware of the existence of FeatureContext until now :-)

--


2013/2/14 Alister Scott <aliste...@gmail.com>
Reply all
Reply to author
Forward
0 new messages