2016-09-25 8 views
0

Mavenで2つのキュウリフィーチャファイルを実行しようとしていますが、何も起こりません。オランダ語(NL)バージョンのGherkinを使用しています。私がフィーチャー・ファイルをEclipseやGradleで直接実行しているときは、正常に動作しています。 Stackoverflowでこの問題に関する以前の質問をすべて調査しましたが、まだ解決策が見つかりませんでした。Mavenがキュウリ試験を無視しています

これはEclipseでの私のプロジェクト構造である: Eclipse project structure

コマンドMVNテストを使用してのMavenでプロジェクトを実行した結果は次のとおりです。

でnl.werkwel.cucumber.RunTest 設定TestNGの実行: [email protected]729 テストを実行:0、失敗:0、エラー:0、スキップ:0、時間が経過:0.341秒

結果:

テストが実行さ:0、失敗:0、エラー:0、スキップ: "MVNテスト-Dcucumber.options =" SRC:0

[INFO]私はまたして実行しようとしたSUCCESS

を構築

:/test/resources/registratiepage.feature」 が、結果はこれが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>nl.werkwel</groupId> 
    <artifactId>cucumber</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>jar</packaging> 

    <name>cucumber</name> 
    <url>http://maven.apache.org</url> 

    <properties> 
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 

    <dependencies> 
    <dependency> 
     <groupId>info.cukes</groupId> 
     <artifactId>cucumber-java</artifactId> 
     <version>1.2.4</version> 
    </dependency> 
    <dependency> 
     <groupId>org.testng</groupId> 
     <artifactId>testng</artifactId> 
     <version>6.8.8</version> 

    </dependency> 

    <dependency> 
     <groupId>org.seleniumhq.selenium</groupId> 
     <artifactId>selenium-java</artifactId> 
     <version>2.53.0</version> 
    </dependency> 

    <dependency> 
     <groupId>javax.mail</groupId> 
     <artifactId>mail</artifactId> 
     <version>1.4.7</version> 
    </dependency> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.12</version> 
    </dependency> 
    <dependency> 
     <groupId>info.cukes</groupId> 
     <artifactId>cucumber-junit</artifactId> 
     <version>1.2.4</version> 
    </dependency> 

    </dependencies> 

</project> 

であり、ここでフィーチャーファイルの1つです

同じでした

# language: nl 
Functionaliteit: Testen van de Registratiepagina 

    Achtergrond: 
     Gegeven Gebruiker is op de registratiepagina 

    Scenario: Niet succesvolle registratie, emailadres niet gevuld 
    Als Gebruiker geen emailadres invult 
    En Klikt op de button nu registreren 
    Dan wordt de melding "Voer een waarde in" getoond 

    Scenario: Link Algeregistreerd 
    Als Gebruiker op link algeregistreerd klikt 
    Dan gaat gebruiker verder naar het inlogscherm 

    Scenario: Link Annuleren 
    Als Gebruiker op link annuleren klikt 
    Dan gaat gebruiker verder naar het inlogscherm 

ランナークラス

package nl.werkwel.cucumber; 

import org.junit.runner.RunWith; 
import cucumber.api.CucumberOptions; 
import cucumber.api.junit.Cucumber; 

@RunWith(Cucumber.class) 
@CucumberOptions(


     plugin = {"pretty", "html:out"}, 
     features={"."} 

     ) 


public class RunTest { 

} 
+0

POMを必要と機能の少なくとも一つ。 – chrylis

+0

あなたの反応のためにThnx Chrylis、私は情報を追加しました。 – Frank

+0

Gradle..joke ...に切り替えます。:) – pczeus

答えて

0

Mavenのはどのテストを見つけるdidntのように思えます。ランナークラスを分かち合うことができますか? また、testngグループIDのスコープを定義することもできます。

https://github.com/cucumber/cucumber-jvm/blob/master/examples/java-calculator-testng/src/test/java/cucumber/examples/java/calculator/RunCukesTest.java

編集:

今日は何か新しいことを学んだ... gegeven ==考えます!

実行しているプロジェクトがありましたが、変更がありました。プロジェクトの構造は、次のとおりです。ここで https://github.com/cucumber/cucumber-jvm/tree/master/examples/java-calculator-testng

をポンポンの変更です: @chrylisは疑問視していたとして、JUnitのとTestNGのは、現在の両方であり、必要ありません。あなたの依存関係がこのようなものになるだろう JUnitの削除:

<dependencies> 
    <dependency> 
     <groupId>org.seleniumhq.selenium</groupId> 
     <artifactId>selenium-java</artifactId> 
     <version>2.53.0</version> 
    </dependency> 

    <dependency> 
     <groupId>javax.mail</groupId> 
     <artifactId>mail</artifactId> 
     <version>1.4.7</version> 
    </dependency> 

    <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-jvm-deps</artifactId> 
      <version>1.0.5</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-java</artifactId> 
      <version>1.2.4</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>info.cukes</groupId> 
      <artifactId>cucumber-testng</artifactId> 
      <version>1.2.4</version> 
      <scope>test</scope> 
      <exclusions> 
       <exclusion> 
        <groupId>junit</groupId> 
        <artifactId>junit</artifactId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
    </dependencies> 

を私はあなたのランナークラスとスイートの実行を行うことができませんでしたし、実行するためTestNGCucumberRunnerクラスを使用していました。

/** Create one test method that will be invoked by TestNG and invoke the 
* Cucumber runner within that method. 
*/ 
    @CucumberOptions(plugin = "json:target/cucumber-report-composite.json") 
    public class RunCukesByCompositionTest { 

    @Test(groups = "examples", description = "Example of using TestNGCucumberRunner to invoke Cucumber") 
    public void runCukes() { 
     new TestNGCucumberRunner(getClass()).runCukes(); 
    } 
} 

enter image description here

+0

ランナークラスを追加しました。テスト用のgroupidの範囲を変更しましたが、肯定的な結果は得られませんでした。 – Frank

+0

これが役に立ったら、@Frank – Sid

+0

Thnx Sidは、最終的に私のテストを実行しました。プロジェクトの構造、pomまたはランナークラスが失敗の理由であるかどうかは不明です。私は3人すべてで変わった。あなたが "gegeven"よりも多くのオランダ語を学ぶことに興味があるなら、あなたは大歓迎です – Frank

関連する問題