title: TestNG using multiple DataProviders with single Test method
body: <p>I have been looking for a way to use multiple DataProviders in my test method. My scenario is as follows:</p>
  
  <p>lets say we have a DataProvider class:</p>
  
  <pre><code>@Test
  public class ExampleDataProvider {
  
     /**
       * Returns the list of shape codes.
       * 
       * @return the collection shape codes.
       */
      @DataProvider(name = "ShapeCodes")
      public static Object[][] getShapeCodes() {
          return new Object[][] { new Object[] { Shape.Square }, 
              new Object[] { Shape.Triangle }
          };
      }
  
      /**
       * Returns the list of color codes.
       * 
       * @return the collection of color codes.
       */
      @DataProvider(name = "ColorCodes")
      public static Object[][] geColorCodes() {
          return new Object[][] { new Object[] { Color.Green }, 
              new Object[] { Color.Red }
          };
      }
  }
  </code></pre>
  
  <p>Now in my Test method I want to run for all combinations of scenarios:</p>
  
  <ol>
  <li>Green-Square</li>
  <li>Red-Square</li>
  <li>Green-Triangle</li>
  <li>Red-triangle</li>
  </ol>
  
  <p>How should I achieve this in my code, given that I cant specify multiple DataProviders with <code>@Test</code> annotation</p>
  
  <pre><code>@Test(dataProvider = "ShapeCodes", dataProviderClass = ExampleDataProvider.class)
      public void test(String ShapeCode, String ColorCode) throws IOException {
          .............
          /* tests for color shape combination */
          .............
      }
  </code></pre>
  
  <p>EDIT : I found a similar problem and a @ <a href="https://stackoverflow.com/questions/4525989/several-dataprovider-per-one-test-in-testng?rq=1">workaround</a> but I am still wondering if there are better ways to handle this.</p>