title: (How) Can Specflow test cases be run with Autofac as the IoC container?
body: <p>I'm trying to adopt BDD in my organization and since C#.Net is our primary mode of development, Specflow is our best bet for "anything Cucumber".</p>
  
  <p>However, I've been a Spring aficionado in the past, but at my company we're using Autofac for various parts of the application. However, I'm unable to find any resources that explain "how" Autofac can be used to "trigger" Specflow's BDD tests and provide the necessary wiring of dependencies.</p>
  
  <p>I plan to have Autofac be responsible for instantiating, wiring and executing everything instead of executing Specflow and have methods calling Autofac littered everywhere i.e., using Autofac as a Service Locator instead of a DI/IoC Container. Can this even be done or am I looking at it the wrong way and there is a better way of achieving the same goal? Or should I purely rely on Specflow's "internal container" for DI and forget about Autofac altogether?</p>
  
  <p>Possible approaches:</p>
  
  <ol>
  <li>Have Autofac instantiate and wire everything and run Specflow tests (not sure if this is even possible/recommended).</li>
  <li>Have Specflow globally instantiate Autofac which is wired with the necessary dependencies for the remainder of the code. Possible that step definitions may land up using Autofac as a factory to get what they need.</li>
  </ol>
  
  <p>Pros/Cons:</p>
  
  <ol>
  <li>The first approach is ideal since it prevents any dependencies from Specflow to Autofac. The former is oblivious of the latter. Completely transparent. Preferred, but not sure how to go about it.</li>
  <li>The latter approach "could" work if Autofac could be globally instantiated by Specflow once for use later. But this would lead to lots of calls to Autofac from within the step definitions coupling the two libraries together. Not preferable. </li>
  </ol>
  
  <p>I'm not sure how to achieve either of them and if it's better to let Specflow handle DI and forget about Autofac or have Autofac fire everything up or if there is some middle ground?</p>
  
  <p>Current BDD setup: Specflow, Selenium/PhantomJS, Xunit. Looking to combine with Autofac.</p>