title: JUnit test cases not running through maven
body: <p>Similar questions have been asked before, but I'm unable to fix this issue.
  I want to automate JUnit test case execution through Maven. </p>
  
  <pre><code>JUnit jar version - 4.8.2
  
  Maven version - 3.2.5
  
  Surefire jar version - 2.14.1
  </code></pre>
  
  <p>When I ran mvn compile test, I got this exception:</p>
  
  <pre><code>[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.14.1:test (default-test) on project my_project: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.) -&gt; [Help 1]
  org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.14.1:test (default-test) on project my_project: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
      at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
      at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
      at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:355)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
      at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
      at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:216)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:160)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
      at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
      at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
      at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
  Caused by: org.apache.maven.plugin.MojoFailureException: No tests were executed!  (Set -DfailIfNoTests=false to ignore this error.)
      at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:55)
      at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:169)
      at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:733)
      at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:631)
      at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
      at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
      ... 19 more
  </code></pre>
  
  <p>These entries are in pom.xml:</p>
  
  <pre><code>&lt;dependency&gt;
              &lt;groupId&gt;org.apache.maven.surefire&lt;/groupId&gt;
              &lt;artifactId&gt;maven-surefire-common&lt;/artifactId&gt;
              &lt;version&gt;2.14.1&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.8.2&lt;/version&gt;
              &lt;type&gt;jar&lt;/type&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
  
  &lt;/dependency&gt;
  
  &lt;plugin&gt;
          &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                      &lt;source&gt;1.7&lt;/source&gt;
                      &lt;target&gt;1.7&lt;/target&gt;
              &lt;/configuration&gt;
  
  &lt;/plugin&gt;
  </code></pre>
  
  <p>I've tried all the stuffs from internet but none worked. Am I missing something?</p>