Class ScreenplayPlugin
- Namespace
- CSF.Screenplay
- Assembly
- CSF.Screenplay.SpecFlowPlugin.dll
The Screenplay plugin for SpecFlow.
public class ScreenplayPlugin : IRuntimePlugin
- Inheritance
-
ScreenplayPlugin
- Implements
-
IRuntimePlugin
- Inherited Members
Remarks
This plugin class is the test framework integration for SpecFlow. Crucially it adds the Screenplay architecture to the SpecFlow architecture.
Becuase this plugin leverages the SpecFlow/BoDi IObjectContainer
, it is likely incompatible with other plugins
which integrate with third party Dependency Injection libraries.
This may be easily worked-around, though. If you are using a third-party DI plugin then do not use this plugin. Instead use the AddScreenplay(IServiceCollection, Action<ScreenplayOptions>) method to add Screenplay to that third-party DI system, when customising the dependency registrations. Adding Screenplay in that way is equivalent to the work done by this plugin.
If you wish to further customise the dependency injection, such as adding injectable services for abilities or implementations of IPersona, add them to the relevant DI container. When using SpecFlow's default BoDi container this is described in the following article https://docs.specflow.org/projects/specflow/en/latest/Bindings/Context-Injection.html#advanced-options. If using a third-party DI container then you should use that container's appropriate mechanism of adding services.
Properties
Screenplay
Provides static access to the Screenplay instance.
public static Screenplay Screenplay { get; }
Property Value
Remarks
This is required because the bindings for beginning/ending the Screenplay in ScreenplayBinding must be static
:
https://docs.specflow.org/projects/specflow/en/latest/Bindings/Hooks.html#supported-hook-attributes.
Methods
Initialize(RuntimePluginEvents, RuntimePluginParameters, UnitTestProviderConfiguration)
public void Initialize(RuntimePluginEvents runtimePluginEvents, RuntimePluginParameters runtimePluginParameters, UnitTestProviderConfiguration unitTestProviderConfiguration)
Parameters
runtimePluginEvents
RuntimePluginEventsruntimePluginParameters
RuntimePluginParametersunitTestProviderConfiguration
UnitTestProviderConfiguration