title: Not able to run test.xml file through maven and command line in java selenium
body: <p>I want to run <code>test.xml</code> file through maven and command line. My <code>test.xml</code> has 4 classes but unfortunately 'mvn test' command only picks one class.</p>
  
  <p>Below is my project structure.
  <a href="https://i.stack.imgur.com/aNEFK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aNEFK.png" alt="Project structure"></a></p>
  
  <p>And here is the code for <code>pom.xml</code></p>
  
  <pre><code>&lt;groupId&gt;com.mobikon.commontestapp&lt;/groupId&gt;
  &lt;artifactId&gt;commontestapp&lt;/artifactId&gt;
  &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
  &lt;repositories&gt;
      &lt;repository&gt;
          &lt;id&gt;central&lt;/id&gt;
          &lt;name&gt;bintray&lt;/name&gt;
          &lt;url&gt;http://jcenter.bintray.com&lt;/url&gt;
      &lt;/repository&gt;
  &lt;/repositories&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;
          &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;
          &lt;version&gt;2.53.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.testng&lt;/groupId&gt;
          &lt;artifactId&gt;testng&lt;/artifactId&gt;
          &lt;version&gt;6.9.10&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.uncommons&lt;/groupId&gt;
          &lt;artifactId&gt;reportng&lt;/artifactId&gt;
          &lt;version&gt;1.1.2&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.testng&lt;/groupId&gt;
                  &lt;artifactId&gt;testng&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-lang&lt;/groupId&gt;
          &lt;artifactId&gt;commons-lang&lt;/artifactId&gt;
          &lt;version&gt;2.5&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
          &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
          &lt;version&gt;2.19.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;commons-configuration&lt;/groupId&gt;
          &lt;artifactId&gt;commons-configuration&lt;/artifactId&gt;
          &lt;version&gt;1.10&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
          &lt;artifactId&gt;commons-configuration2&lt;/artifactId&gt;
          &lt;version&gt;2.1&lt;/version&gt;
  
      &lt;/dependency&gt;
  
  &lt;/dependencies&gt;
  
  &lt;profiles&gt;
  
      &lt;profile&gt;
          &lt;id&gt;test&lt;/id&gt;
          &lt;build&gt;
              &lt;plugins&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.19.1&lt;/version&gt;
  
  
                      &lt;configuration&gt;
                          &lt;properties&gt;
                              &lt;property&gt;
                                  &lt;name&gt;usedefaultlisteners&lt;/name&gt;
                                  &lt;value&gt;false&lt;/value&gt;
                              &lt;/property&gt;
                              &lt;property&gt;
                                  &lt;name&gt;listener&lt;/name&gt;
                                  &lt;value&gt;org.uncommons.reportng.HTMLReporter, org.uncommons.reportng.JUnitXMLReporter&lt;/value&gt;
                              &lt;/property&gt;
                          &lt;/properties&gt;
  
                          &lt;suiteXmlFiles&gt;
                              &lt;suiteXmlFile&gt;test.xml&lt;/suiteXmlFile&gt;
                          &lt;/suiteXmlFiles&gt;
                          &lt;!--&lt;workingDirectory&gt;target/&lt;/workingDirectory&gt;--&gt;
                      &lt;/configuration&gt;
  
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/build&gt;
      &lt;/profile&gt;
  &lt;/profiles&gt;
  </code></pre>
  
  <p></p>
  
  <p>And Here is code for <code>test.xml</code></p>
  
  <pre><code>&lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" &gt;
  &lt;suite name="Mobikon Automation Tests" verbose="1" &gt;
  
      &lt;test name="mEngage" &gt;
          &lt;classes&gt;
              &lt;class name="mengage.tests.LoginScenarios"&gt;&lt;/class&gt;
              &lt;class name="mengage.tests.PurchaseCreditsTest"&gt;&lt;/class&gt;
              &lt;class name="mengage.tests.VerifyTotalCustomers"&gt;&lt;/class&gt;
              &lt;class name="mengage.tests.VerifyCredits"&gt;&lt;/class&gt;
          &lt;/classes&gt;
      &lt;/test&gt;
  &lt;/suite&gt;
  </code></pre>
  
  <p>So now if I run maven from the command line this is the output.It is taking only PurchaseCredits class. </p>
  
  <p>Command - <code>mvn clean test</code></p>
  
  <p>If I run from IntelliJ directly it is running properly, so the only issue I am facing is I am not able to run a proper <code>test.xml</code> file from maven</p>
  
  <p>after mvn -Ptest clean test, this is the screenshot for Maven
  <a href="https://i.stack.imgur.com/PtY05.png" rel="nofollow noreferrer">enter image description here</a></p>