title: How to use datadriven test within @BeforeClass method in TestNG framework
body: <p>Want to take urls one by one at <code>@BeforeClass</code> method and perform action in different <code>@Test</code> methods.   </p>
  
  <p>But <code>@dataProvider</code> only can used along with <code>@Test</code> method not with <code>@BeforeClass</code>  in <code>TestNG</code> </p>
  
  <p>constraint:-</p>
  
  <ul>
  <li><p>Actually, All <code>@Test</code> method are independent on each other and So cant use single test method.</p></li>
  <li><p>urls in <code>@dataProvider</code> is always be changing. We gets urls in run-time </p></li>
  </ul>
  
  <p>How could we manage such scenarios ? </p>
  
  <p>In short architecture of framework:- </p>
  
  <pre><code>     @BeforeClass(dataProvider = "getTestUrls") 
          public void testPage(){
              driver.get(testUrls);
         }
  
        @Test(priority=1)
        @Test(priority=2)
  
       @DataProvider
          public Object [][] getTestUrls(){
              return new Object[][]   { { 1,"http://www.yahoo.com" }, {2,"http://www.google.com" } };
      }
  </code></pre>