title: Excluding TestNG Groups From Maven
body: <p>I have some slow tests that rely on the database that I don't want run every time I build my project with Maven. I've added the excludedGroups element to my pom file as explained <a href="http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#excludedGroups" rel="nofollow">http://maven.apache.org/plugins/maven-surefire-plugin/test-mojo.html#excludedGroups</a> but I can't seem to get it working.</p>
  
  <p>I've created a minimal project. Here is the pom.xml:</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
      &lt;groupId&gt;test&lt;/groupId&gt;
      &lt;artifactId&gt;exclude&lt;/artifactId&gt;
      &lt;version&gt;0.0.1-SNAPSHOT&lt;/version&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.6&lt;/source&gt;
                      &lt;target&gt;1.6&lt;/target&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.4.2&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;excludedGroups&gt;db&lt;/excludedGroups&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.testng&lt;/groupId&gt;
              &lt;artifactId&gt;testng&lt;/artifactId&gt;
              &lt;version&gt;5.14&lt;/version&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>And these are the two test classes:</p>
  
  <pre><code>public class NormalTest {
  
      @Test
      public void fastTest() {
          Assert.assertTrue(true);
      }
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>public class DatabaseTest {
  
      @Test(groups={"db"})
      public void slowTest() {
          Assert.assertTrue(false);
      }
  }
  </code></pre>
  
  <p>However both tests still run. I can't figure out what I'm doing wrong.</p>