title: Selenium UI Testing: TestCleanup() quits rest of the tests after the first test is loaded
body: <p>I am automating my github profile and Following are my test cases:</p>
  
  <ul>
  <li>Load Browser (this is defined in testInitialize()</li>
  <li>Load Url</li>
  <li>Perform Login
  Below is the code snippet:</li>
  </ul>
  
  <p>namespace GitAutomationTest
      {
      using Microsoft.VisualStudio.TestTools.UnitTesting;
      using OpenQA.Selenium.IE;
      using OpenQA.Selenium.Remote;
      using System;
      [TestClass]
          public class GitTest 
          {
              private string baseURL = "<a href="https://github.com/login" rel="nofollow">https://github.com/login</a>";
              private RemoteWebDriver driver;
              public TestContext TestContext { get; set; }</p>
  
  <pre><code>     [TestMethod]
       public void LoadURL() {
              driver.Navigate().GoToUrl(baseURL);
              Console.Write("Loaded URL is :" + baseURL);
          }
          [TestMethod]
          public void PerformLogin() { 
              driver.FindElementById("login_field").SendKeys("USERNAME");
              driver.FindElementById("password").SendKeys("PASSWORD");
              Console.Write("password entered \n ");
              driver.FindElementByClassName("btn-primary").Click();
              driver.GetScreenshot().SaveAsFile(@"screenshot.jpg", format: System.Drawing.Imaging.ImageFormat.Jpeg);
              Console.Write("Screenshot Saved: screenshiot.jpg");
          }
          [TestCleanup()]
          public void MyTestCleanup()
          {
              driver.Quit();
          }
          [TestInitialize()]
          public void MyTestInitialize()
          {
              driver = new InternetExplorerDriver();
              driver.Manage().Window.Maximize();
              Console.Write("Maximises The window\n");
              driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(20));
          }
      }
  }
  </code></pre>
  
  <p><strong>OUTPUT</strong> <br>
  Everytime I run all tests:
   - Test is initialized : the internet explorer is loaded
   - The base url is loaded
   - Then the driver quits with TestCleanUP()</p>
  
  <p>Next time the driver runs testperformLogin()
   - The test cannot find the username and password elements to perform login, because the base url is not loaded this time.</p>
  
  <p><strong>How can we manage the TestInitialize() class such that:</strong>
   - browser is up with baseurl until all the tests are completed.
  <strong>How can we manage TestCleanup() such that:</strong> 
  - browser closes only after all the test are completed.   </p>