Skip to content

SpecFlow plugin for using SimpleInjector as a dependency injection framework for step definitions

License

Notifications You must be signed in to change notification settings

AdaskoTheBeAsT/SpecFlow.SimpleInjector

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SpecFlow.SimpleInjector

SpecFlow plugin for using SimpleInjector as a dependency injection framework for step definitions.

Currently supports

  • SpecFlow v3.1.80
  • SimpleInjector v4.9.0 or above

License: Apache (https://github.com/jguc/SpecFlow.SimpleInjector/blob/master/LICENSE)

NuGet: https://www.nuget.org/packages/SpecFlow.SimpleInjector

Build status NuGet version

Usage

Install plugin from NuGet into your SpecFlow project.

PM> Install-Package SpecFlow.SimpleInjector

Create a static method somewhere in the SpecFlow project (recommended to put it into the Support folder) that returns an SimpleInjector Container and tag it with the [ScenarioDependencies] attribute. Configure your dependencies for the scenario execution within the method.

A typical dependency builder method probably looks like this:

[ScenarioDependencies]
public static Container CreateContainer()
{
  // create container with the runtime dependencies
  var builder = Dependencies.CreateContainer();

  //TODO: add customizations, stubs required for testing

  return builder;
}

Plugin based on

http://gasparnagy.com/2016/08/specflow-tips-customizing-dependency-injection-with-autofac/

Release history

v2.0.0

  • Conversion to .NET Standard 2.0 project (PR#8 by toadicusrex)
  • Updated libraries (SpecFlow and SimpleInjector)
  • Changed nuget publish process to .NET Standard
  • Updated example project

v1.2.0

  • Support for SpecFlow v3

v1.1.0

v1.0.2

  • First release supporting SpecFlow v2.1

About

SpecFlow plugin for using SimpleInjector as a dependency injection framework for step definitions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%