title: Starting and Stopping chromedriver once per test session
body: <p>I have a bunch of selenium tests that run as part of specflow scenarios. I am currently starting and stopping the ChromeDriver once per feature:</p>
  
  <pre><code>[Binding]
  public class WebBrowser
  {
      public static IWebDriver Current
      {
          get
          {
              if (!FeatureContext.Current.ContainsKey("browser"))
              {
                  FeatureContext.Current["browser"] = new ChromeDriver();
              }
              return (IWebDriver)FeatureContext.Current["browser"];
          }
      }
  
      [BeforeFeature]
      public static void Close()
      {
          if (FeatureContext.Current.ContainsKey("browser"))
          {
              Current.Close();
              ((ChromeDriver) FeatureContext.Current["browser"]).Quit();
          }
      }
  }
  </code></pre>
  
  <p>The tests would run much faster if I could create and quit the chromedriver once per unit test session run rather than once per feature run.</p>
  
  <p>Is there a way to configure nunit to run some code at the end of each run? </p>
  
  <p>If I remove the <code>chromedriver.Quit()</code> call then:</p>
  
  <ul>
  <li>The Resharper test runner spins forever after running my tests never reporting the test run as complete.</li>
  <li>The NUnit test runner works fine but leaves a running driver window after each test session run.</li>
  </ul>
  
  <p>It would be great if I could have some code create the chromedriver before the first test is run and stop it after the last test is run.</p>
  
  <p>Update: Changed <code>[BeforeScenario]</code> to <code>[BeforeFeature]</code> - thanks to Lee for pointing this out.</p>