title: Run multiple selenium java test cases as suite with Testng
body: <p>Hi all I have written multiple test cases in selenium to perform following task using <code>WebDriver</code></p>
  
  <ol>
  <li>Login to my portal</li>
  <li>Add Group</li>
  <li>Add Location </li>
  </ol>
  
  <p>following is my selenium code to perform this task on my portal</p>
  
  <p><strong><em>Base Selenium Class</em></strong></p>
  
  <pre><code>public class BaseSeleniumTest extends SeleneseTestBase {
      protected static WebDriver driver;
      @BeforeSuite
      public static void firefoxSetUp() throws MalformedURLException {
          driver = new FirefoxDriver();
          driver.manage().window().maximize();
      }
  
      @AfterSuite
      public static void closeFirefox(){
         driver.quit();
      }
  }//End BaseSeleniumTest Class.
  </code></pre>
  
  <p><strong><em>Login Test Case</em></strong></p>
  
  <pre><code>public class LogInTest extends BaseSeleniumTest {
      LogInPage page;
      public static final String BASE_URL = "http://www.mywebsite.com";
  
      @BeforeMethod
      public void beforeMethod() {
          page = PageFactory.initElements(driver, LogInPage.class);
          page.openPage(BASE_URL);
      }
  
      @Test(dataProvider="loginData",groups="loginGroup")
      public void logIn(String email,String password) {
          page.logInAs(email, password);
      }
  
      @DataProvider(name = "loginData")
      public Object[][] getData() {
          return new Object[][] { { "username", "password" } };
      }
  }//End of LogInTest Class.
  </code></pre>
  
  <p><strong><em>Add Group Test Case</em></strong></p>
  
  <pre><code>public class AddGroupTest extends BaseSeleniumTest {
      AddGroupPage addGroupPage;
        @BeforeMethod
        public void openAddGroupPage() {
            addGroupPage = PageFactory.initElements(driver, AddGroupPage.class);
            addGroupPage.openPage();
        }
  
      @Test(dataProvider = "getCSVData",dataProviderClass=AddGroupsDataProvider.class,dependsOnGroups={"loginGroup"},groups="addGroup")
      public void AddGroup(String groupName,String displayName,String description) {
              addGroupPage.addGroup(groupName, displayName, description);
              driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
      }
  }//End of AddGroupTest Class.
  </code></pre>
  
  <p><strong><em>Add Location test Case</em></strong></p>
  
  <pre><code>public class AddLocationTest extends BaseSeleniumTest {
      AddLocationPage addLocationPage;
      @BeforeMethod
        public void openAddLocationPage() {
            addLocationPage = PageFactory.initElements(driver, AddLocationPage.class);
            addLocationPage.openPage();
       }
  
      @Test(dataProvider = "getCSVData", dataProviderClass = AddLocationDataProvider.class, dependsOnGroups = { "loginGroup" }, groups = "addLocation")
      public void addLocation(String locationName, String displayName,
              String description, String groups) {
          addLocationPage.addLocation(locationName, displayName, description,
                  groups.split(","));
      }
  }  
  </code></pre>
  
  <p>when I run this script independently they run perfectly now I want to run this scripts as suite but I don't know where to start from. As my Add Location Test case dependent on Add Group and Add Group test case is dependent on Login test case.</p>
  
  <p>following are my questions</p>
  
  <ol>
  <li><strong>what I have do ? to run this test cases as suite.(later I have to run this suite through jar file)</strong></li>
  <li><strong>How I can specify dependencies among them ?</strong></li>
  </ol>
  
  <p>Thanks in advance...</p>