2013-08-23 145 views
0

我在使用maven surefire時遇到了問題,因爲它不能運行我的測試。 我知道這個問題已經被問了很多次之前,我已經嘗試了許多東西都沒有成功Maven Surefire未找到測試

  1. 我改變了我的測試目錄的名稱爲src/test/java下
  2. 我改的名字我測試以適應*測試模式
  3. 我嘗試了Junit3測試
  4. 我試着具體包括在POM

也許有人對你能指出我可能愚蠢的錯誤的測試。

我POM是下面列出

<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"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>BitTrader</groupId> 
    <artifactId>BitTrader</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <name>BitTrader</name> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <sonar.language>java</sonar.language> 
     <sonar.jdbc.url> 
      jdbc:h2:tcp://lustigsbusi.ch:9092/sonar 
     </sonar.jdbc.url> 
     <sonar.host.url> 
      http://lustigsbusi.ch:9000 
     </sonar.host.url> 
    </properties> 
    <build> 
     <!-- To define the plugin version in your parent POM --> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.codehaus.mojo</groupId> 
        <artifactId>sonar-maven-plugin</artifactId> 
        <version>2.1</version> 
       </plugin> 
      </plugins> 
     </pluginManagement> 
     <plugins> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>sonar-maven-plugin</artifactId> 
      </plugin> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>3.0</version> 
       <configuration> 
        <source>1.7</source> 
        <target>1.7</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.16</version> 
       <configuration> 
        <includes> 
         <include>CombinedOrderBookTest.java</include> 
        </includes> 
       </configuration> 

      </plugin> 
     </plugins> 
    </build> 
    <repositories> 

    </repositories> 
    <dependencies> 
     <dependency> 
      <groupId>commons-collections</groupId> 
      <artifactId>commons-collections</artifactId> 
      <version>3.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.google.guava</groupId> 
      <artifactId>guava</artifactId> 
      <version>14.0.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-log4j12</artifactId> 
      <version>1.7.5</version> 
     </dependency> 
     <dependency> 
      <groupId>io.netty</groupId> 
      <artifactId>netty</artifactId> 
      <version>3.6.6.Final</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.tomcat</groupId> 
      <artifactId>tomcat-coyote</artifactId> 
      <version>7.0.41</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-io</groupId> 
      <artifactId>commons-io</artifactId> 
      <version>1.3.2</version> 
     </dependency> 
     <dependency> 
      <groupId>net.sf.opencsv</groupId> 
      <artifactId>opencsv</artifactId> 
      <version>2.3</version> 
     </dependency> 
     <dependency> 
      <groupId>com.xeiam.xchange</groupId> 
      <artifactId>xchange-core</artifactId> 
      <version>1.8.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.xeiam.xchange</groupId> 
      <artifactId>xchange-examples</artifactId> 
      <version>1.8.0</version> 
      <exclusions> 
       <exclusion> 
        <artifactId>logback-classic</artifactId> 
        <groupId>ch.qos.logback</groupId> 
       </exclusion> 
       <exclusion> 
        <artifactId>logback-core</artifactId> 
        <groupId>ch.qos.logback</groupId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
     <dependency> 
      <groupId>com.xeiam.xchange</groupId> 
      <artifactId>xchange-bitcoincharts</artifactId> 
      <version>1.8.0</version> 
     </dependency> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.8.1</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.xeiam.xchange</groupId> 
      <artifactId>xchange-bitstamp</artifactId> 
      <version>1.8.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.xeiam.xchange</groupId> 
      <artifactId>xchange-btce</artifactId> 
      <version>1.8.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.xeiam.xchange</groupId> 
      <artifactId>xchange-campbx</artifactId> 
      <version>1.8.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.xeiam.xchange</groupId> 
      <artifactId>xchange-cavirtex</artifactId> 
      <version>1.8.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.xeiam.xchange</groupId> 
      <artifactId>xchange-mtgox</artifactId> 
      <version>1.8.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.xeiam.xchange</groupId> 
      <artifactId>xchange-openexchangerates</artifactId> 
      <version>1.8.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.google.code.gson</groupId> 
      <artifactId>gson</artifactId> 
      <version>2.2.4</version> 
     </dependency> 
    </dependencies> 
</project> 

編輯 它與DTEST。

這是MVN測試的輸出 http://pastebin.com/bZ9Mg4Bs

+0

對我來說似乎沒問題,試試'mvn clean install -X',這會給你更多的信息 – mokuril

回答

2

如果你的測試類遵循命名約定,那麼就沒有必要指定包括。

真正的問題是,它看起來像'CombinedOrderBookTest.java'不能匹配。

+0

我同意我只包括它所以導致它看看它是否會工作 - >它沒有 – benehsv

+1

如果你運行它從cmdline,你可以嘗試添加'-Dtest = CombinedOrderBookTest'(確實沒有'.java') –

+0

這工作正常,測試運行但我仍然知道爲什麼它不會自動運行測試 – benehsv

相關問題