title: How do I have TestNG run tests in specific groups (from the command-line)?
body: <p>I'm invoking TestNG from the command-line like this:</p>
  
  <pre><code>java org.testng.TestNG -groups "foo" testng.xml
  </code></pre>
  
  <p>...with the intention of only running tests annotated with:</p>
  
  <pre><code>@Test(groups = { "foo" })
  </code></pre>
  
  <p>...but it's running all my tests.  Do I need to change my testng.xml file?</p>
  
  <p></p>
  
  <pre><code>&lt;suite name="BarSuite" verbose="1"&gt;
    &lt;test name="AllInPackage"&gt;
      &lt;packages&gt;
        &lt;package name="com.example.bar"/&gt;
     &lt;/packages&gt;
   &lt;/test&gt;
  &lt;/suite&gt;
  </code></pre>
  
  <p>Is TestNG ignoring the -groups command-line argument because testng.xml says to run all the tests in the package?  If so, how should I change my testng.xml file?</p>