forked from nbehave/NBehave
-
Notifications
You must be signed in to change notification settings - Fork 0
Context
MorganPersson edited this page Aug 29, 2012
·
2 revisions
There are 2 context that you can access in NBehave, FeatureContext and ScenarioContext.
- FeatureContext lives during the execution of the entire feature.
- You access the feature context with
FeatureContext.Current - From the context you can get the title of the feature with
FeatureContext.Current.FeatureTitle - You can get the tags the feature has with
FeatureContext.Current.Tags - The FeatureContext is also a
Dictionary<string, object>in which you can store stuff in. - NBehave will call
Dispose()on all items in the FeatureContext that implementsIDisposablewhen the FeatureContext is destroyed.
- ScenarioContext lives for the duration of a scenario.
- You access the scenario context with
ScenarioContext.Current - From the context you can get the title of the scenario with
ScenarioContext.Current.ScenarioTitle. - You can also access the FeatureContext from the ScenarioContext with
ScenarioContext.Current.FeatureContext - You can get the tags the scenario has with
ScenarioContext.Current.Tags - The ScenarioContext is also a
Dictionary<string, object>in which you can store stuff in. - NBehave will call
Dispose()on all items in the ScenarioContext that implementsIDisposablewhen the ScenarioContext is destroyed.