jeudi 28 mai 2015

Maven runs all tests with keyword "Test"

I have set up a maven project with Junit tests to run Selenium (java) scripts on our build server. From what I read Maven is meant to run any files specified in the folder test.java

With this in mind I set up my project with a TestAll class using@RunWith and @SuiteClasses to run specifically the classes and tests I wanted.

However, when I run mvn test maven runs all methods that have the keyword test anywhere in the title, ie Test_A_1423, all tests in a class with "Test" in the title and everything in any package with the keyword "Test". How do I run only the tests that I want or do I need to remove "Test" from any class or method I dont want to run. Included is my pom.xml file

`
 <modelVersion>4.0.0</modelVersion>
<groupId>cyberx.automation</groupId>
<artifactId>tests</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>cyberx.test.automation</name>
<url>http://ift.tt/19pvvEY;
<!--<repositories>-->
    <!--<repository>-->
        <!--<id>central</id>-->
        <!--<name>bintray</name>-->
        <!--<url>http://ift.tt/1JWJxEv;
    <!--</repository>-->
<!--</repositories>-->
<dependencies>
<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.12</version>
</dependency>
<dependency>
 <groupId>org.seleniumhq.selenium</groupId>
 <artifactId>selenium-java</artifactId>
 <version>2.45.0</version>
</dependency>
<dependency>
  <groupId>joda-time</groupId>
  <artifactId>joda-time</artifactId>
  <version>2.3</version>
 </dependency>
  <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-api</artifactId>
      <version>2.0.1</version>
   </dependency>
   <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
   </dependency>
   <!--<dependency>-->
      <!--<groupId>org.testng</groupId>-->
      <!--<artifactId>testng</artifactId>-->
      <!--<version>6.9.4</version>-->
      <!--<scope>test</scope>-->
   <!--</dependency>-->
   <dependency>
      <groupId>net.sf.opencsv</groupId>
      <artifactId>opencsv</artifactId>
      <version>2.3</version>
   </dependency>
  </dependencies>
  <build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
 </build>
 </project>
`

Aucun commentaire:

Enregistrer un commentaire