2017-05-03 12 views
0

enter image description here私はJenkinsとmavenからスカラーテストを実行すると、次の出力が表示されます。なぜ私はsrc/test/scalaの下にある私のscalaテストを選んでいないのか分かりません。ジェンキンスコンソール出力の 出力はfollows-mavenはjenkinsを通してscalaテストを実行しません

[INFO] [scalatest:test {execution: test}] 
[36mRun starting. Expected test count is: 0[0m 
[32mDiscoverySuite:[0m 
[36mRun completed in 905 milliseconds.[0m 
[36mTotal number of tests run: 0[0m 
[36mSuites: completed 1, aborted 0[0m 
[36mTests: succeeded 0, failed 0, ignored 0, pending 0[0m 
[32mAll tests passed.[0m 

enter image description here

上記の通りである私のフォルダ構造です。 PFB私pom.xml-

<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>com.hsbc.ftp.bigdata</groupId> 
    <artifactId>rpf</artifactId> 
    <version>${rpf.release.version}</version> 

    <distributionManagement> 

     <repository> 
      <id>dsnexus-releases</id> 
      <name>Nexus Release Repository</name> 
      <url>https://dsnexus.uk.hibm.hsbc:8081/nexus/content/repositories/releases</url> 
     </repository> 


     <snapshotRepository> 
      <id>dsnexus-snapshots</id> 
      <name>Nexus Snapshot Repository</name> 
      <url>https://dsnexus.uk.hibm.hsbc:8081/nexus/content/repositories/snapshots</url> 
     </snapshotRepository> 

    </distributionManagement> 

    <properties> 
     <maven.compiler.source>1.7</maven.compiler.source> 
     <maven.compiler.target>1.7</maven.compiler.target> 
     <encoding>UTF-8</encoding> 
     <scala.version>2.10.5</scala.version> 



    </properties> 

    <build> 
    <testSourceDirectory>src/test/scala</testSourceDirectory> 
    <sourceDirectory>src/main</sourceDirectory> 
    <resources> 
     <resource> 
     <directory>src/main</directory> 
     <excludes> 
      <exclude>**/*.java</exclude> 
      <exclude>**/*.scala</exclude> 
     </excludes> 
     </resource> 
    </resources> 
    <plugins> 
     <plugin> 
       <groupId>org.scala-tools</groupId> 
       <artifactId>maven-scala-plugin</artifactId> 
       <version>2.15.0</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>compile</goal>        
         </goals>       
        </execution> 
       </executions> 
     </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-jar-plugin</artifactId> 
      <version>2.4</version> 
      <configuration> 
       <archive> 
        <index>true</index> 
        <manifest> 
         <mainClass>com.hsbc.ftp.rpf.driver.RPFDriver</mainClass> 
        </manifest> 
       </archive> 
      </configuration> 
     </plugin> 

<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-surefire-plugin</artifactId> 
    <version>2.7</version> 
    <configuration> 
    <skipTests>true</skipTests> 
    </configuration> 
</plugin> 


<plugin> 
    <groupId>org.scalatest</groupId> 
    <artifactId>scalatest-maven-plugin</artifactId> 
    <version>1.0</version> 
    <configuration> 
    <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory> 
    <junitxml>.</junitxml> 
    <filereports>WDFTestSuite.txt</filereports> 
    <skipTests>false</skipTests> 
    </configuration> 
    <executions> 
    <execution> 
     <id>test</id> 
     <goals> 
     <goal>test</goal> 
     </goals> 
    </execution> 
    </executions> 
</plugin> 

     </plugins> 
    </build> 


    <dependencies> 
     <dependency> 
      <groupId>org.apache.spark</groupId> 
      <artifactId>spark-core_2.10</artifactId> 
      <version>1.6.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.spark</groupId> 
      <artifactId>spark-hive_2.10</artifactId> 
      <version>1.6.1</version> 
     </dependency> 
     <dependency> 
       <groupId>joda-time</groupId> 
       <artifactId>joda-time</artifactId> 
       <version>2.9.4</version> 
     </dependency> 
     <dependency> 
      <groupId>joda-time</groupId> 
      <artifactId>jodaExt</artifactId> 
      <version>0.1.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.joda</groupId> 
      <artifactId>joda-convert</artifactId> 
      <version>1.2</version> 
     </dependency> 
<dependency> 
    <groupId>org.scalatest</groupId> 
    <artifactId>scalatest_2.10</artifactId> 
    <version>1.9.1</version> 
    <scope>test</scope> 
</dependency>     
    </dependencies> 
</project> 

は、あなたは私のScalaのテストを実行することができますどのように提案してくださいだろうか?

おかげ アビシェークSomani

+0

ローカルでスカラテストを実行できましたか?使用している同じプラグイン( 'scalatest-maven-plugin')を使ってジェンキンズでスカラーテストを実行しています - https://github.com/nihil- os/stream-driver/blob/kinesis-stream/pom.xml#L199 – prayagupd

+0

いいえ...同じ問題ですが、私のローカルマシンにいくつかのアクセスの問題があり、その理由はJenkinsからはうまくいくはずです。しかし、運がない! –

+0

「完了しました1」と書かれていますが、テストクラス内にテストがありますか? – prayagupd

答えて

0

は、Mavenを使用してscalatestsを実行できるようにするscala-maven-pluginプラグインを追加します。私はあなたのシナリオを試してみました。それはscala-maven-plugintestCompileゴールでのみ動作します。

スカラ - 達人 - プラグインは、(以前のmaven-スカラ・プラグイン - https://mvnrepository.com/artifact/org.scala-tools/maven-scala-plugin/2.15.2) コンパイル/試験/ Mavenの中/文書化Scalaのコードを実行するために使用されます。

 <plugin> 
      <groupId>net.alchim31.maven</groupId> 
      <artifactId>scala-maven-plugin</artifactId> 
      <version>3.2.2</version> 
      <executions> 
       <execution> 
        <id>compile</id> 
        <goals> 
         <goal>testCompile</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

     <plugin> 
      <groupId>org.scalatest</groupId> 
      <artifactId>scalatest-maven-plugin</artifactId> 
      <version>1.0</version> 
      <configuration> 
       <parallel>false</parallel> 
       <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory> 
       <junitxml>.</junitxml> 
       <filereports>test-suite.log</filereports> 
      </configuration> 
      <executions> 
       <execution> 
        <id>test</id> 
        <goals> 
         <goal>test</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 

それとも、すでに maven-scala-pluginを持っているので、ちょうどあなたの実行のゴールが testCompileを追加します。

 <plugin> 
      <groupId>org.scala-tools</groupId> 
      <artifactId>maven-scala-plugin</artifactId> 
      <version>2.15.0</version> 
      <executions> 
       <execution> 
        <goals> 
         <goal>compile</goal> 
         <goal>testCompile</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 

私はhttp://www.scalatest.org/user_guide/using_the_scalatest_maven_pluginが真でないだけscalatest-maven-pluginに言及している知っています。 scalatest-maven-pluginはテストを検出しようとしますが、何も実行しません。

+1

それは働きました!!!!多くのPrayagありがとう!このテストは失敗しましたが、少なくとも今度はスキップしませんでした! –

+0

それはあなたのために働いてうれしい。スカートでおどろく – prayagupd

関連する問題