2016-07-03 19 views
0

キュウバーランナーファイル(JUnitとして)を問題なく実行できます。テストが実行され、うまく動作します。キュウナランナーファイルは、メイヴンから実行されたときにフィーチャー/クラスを取得することができません

しかし、私はmavenを実行しますが、mavenはRunnerファイルを指していますが、テストを実行できません。

私のmavenログとpom.xmlファイルを見つけてください。誰かがpom.xmlにないものを教えてくれますか?またはEclipseの設定?

[INFO] Scanning for projects... 
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building LinenHousePOC 0.0.1-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ LinenHousePOC --- 
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory E:\Programming\Cucumber\LinenHousePOC\src\main\resources 
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ LinenHousePOC --- 
[INFO] Nothing to compile - all classes are up to date 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ LinenHousePOC --- 
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] Copying 0 resource 
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ LinenHousePOC --- 
[INFO] Nothing to compile - all classes are up to date 
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ LinenHousePOC --- 
[INFO] Surefire report directory: E:\Programming\Cucumber\LinenHousePOC\target\surefire-reports 

------------------------------------------------------- 
T E S T S 
------------------------------------------------------- 
Running runners.RunnerTest 
Configuring TestNG with: [email protected]52 
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.041 sec 

Results : 

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 

[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD SUCCESS 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 13.463 s 
[INFO] Finished at: 2016-07-03T10:45:17+05:30 
[INFO] Final Memory: 8M/19M 
[INFO] ------------------------------------------------------------------------ 

後、私のpom.xmlである:あなたの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>LinenHousePOC</groupId> 
    <artifactId>LinenHousePOC</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>exec-maven-plugin</artifactId> 
       <version>1.2.1</version> 
      </plugin> 
     </plugins> 
    </build> 
    <dependencies> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>4.11</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-java</artifactId> 
      <version>1.2.4</version> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-picocontainer</artifactId> 
      <version>1.2.4</version> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-junit</artifactId> 
      <version>1.2.4</version> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-testng</artifactId> 
      <version>1.1.5</version> 
     </dependency> 
     <dependency> 
      <groupId>org.seleniumhq.selenium</groupId> 
      <artifactId>selenium-java</artifactId> 
      <version>2.47.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.testng</groupId> 
      <artifactId>testng</artifactId> 
      <version>6.9.10</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.relevantcodes</groupId> 
      <artifactId>extentreports</artifactId> 
      <version>2.41.0</version> 
     </dependency> 
    </dependencies> 
</project> 
+1

キュウリランナークラスも投稿できますか? –

+0

POM –

+0

のランナークラスファイル名は何ですか?私はあなたの設定で特定のランナーファイルを使用するようにMaven POMに指示していません。ランナーファイル名を指定するには、includeタグを使用します。 –

答えて

0

更新!

以下の設定を使用してmvn clean verifyを実行してください。テストを並行して実行しない場合は、parallel、perCoreThreadCountおよびthreadCountClassesタグを削除します。 IDEは、コマンドライン(Mavenの)からテストを実行すると異なっているからテストを実行するテストの命名規則** /ファイル名を指定して実行* .javaファイル

  <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.16</version> 
       <executions> 
        <execution> 
         <id>acceptance-test</id> 
         <phase>integration-test</phase> 
         <goals> 
          <goal>test</goal> 
         </goals> 
         <configuration> 
          <outputEncoding>UTF-8</outputEncoding> 
          <parallel>classes</parallel> 
          <perCoreThreadCount>true</perCoreThreadCount> 
          <threadCountClasses>10</threadCountClasses> 
          <argLine>-Xmx1024m</argLine> 
          <argLine>-XX:MaxPermSize=256m</argLine> 
          <includes> 
           <include>**/Run*.java</include> 
          </includes> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
0

にマッチする正規表現を更新することを確認します。

IDEでは、テストを呼び出すときにコンテキスト変数が自動的に初期化または選択されます。 Mavenの実行と同様に、明示的に言及する必要のあるパラメータはほとんどありません。

あなたがテストを呼び出す:Mavenを用いた試験を実行

(コマンドライン)

mvn clean test -Dcucumber.options="--format json-pretty --glue classpath:src/test/resources"

上記コマンドは、テストにより採取する必要がある場所から糊を設定しますテストを呼び出すことができます。

この糊情報は、プロファイルを作成しようcucumber.optionsを渡す(Mavenのプロファイルを使用して)Mavenを用いた試験

を実行CucumberRunner.java

CucumberOptionsに入力として渡された情報と同じです

<profiles> 
    <profile> 
    <id>cucumber-tests</id> 
    <properties> 
     <cucumber.options>--glue src/test/resources</cucumber.options> 
    </properties> 

    . . . 
    </profile> 
</profiles> 
関連する問題