SpecFlow icon indicating copy to clipboard operation
SpecFlow copied to clipboard

Documentation request: Context injection with exchanged DI container

Open timmkrause opened this issue 4 years ago • 1 comments

Product:

  • [x] SpecFlow
  • [ ] SpecFlow+ Runner
  • [ ] SpecFlow+ LivingDoc
  • [ ] SpecMap

What is missing:

I setup Autofac as the DI framework/container of choice like this:

https://docs.specflow.org/projects/specflow/en/latest/Integrations/Autofac.html?highlight=autofac#a-typical-dependency-builder-method-probably-looks-like-this

Using context injection does not to resolve "custom" contexts by default now and these need to be registered in the DI container. Can somebody confirm this?

Would it be a good idea to add this detail to the documentation?

And if really every context needs to be registered, does somebody have an opinion about best practices on a reflection based approach? What do you prefer? Naming convention (*SpecFlowContext)? Custom attribute on context classes? Shared base class?

timmkrause avatar Sep 16 '21 13:09 timmkrause

Just want to have this confirmed by somebody else, after that I would be happy to extend the documentation myself.

timmkrause avatar Sep 30 '21 18:09 timmkrause