2016-11-14 12 views
0

キュウリのタグとJunitの設定に関連する問題に直面しています。古いキュウリと最近のキュウリには違いがあります。キュウリのタグ(Given、When、Then)とJUnit(Cucumber.class、Cucumber.Options(..))の最新のキュウリと古いキュウリとの問題

  1. Iは、キュウリ1.0.2ジャーとCucumber.Options(..)
  2. Iは最初のケースではキュウリ1.2.2ジャーとCucumberOptions(..)

を使用しているを使用してい@Given、@When、@Thenタグは正常に動作していますが、Junitの設定ではCucumber.classとCucumber.Options()の問題に直面しています。

2番目のケースでは、CucumberOptions(..)(最新バージョンで更新されたもの)は問題なく動作していますが、@ Given、@When、@Thenで問題が発生しています。

誰かが正しいキュウリタグとJUnit設定をjarバージョンに関して提供してもらえますか?

ケース1: のpom.xml

<dependency> 
    <groupId>info.cukes</groupId> 
    <artifactId>cucumber-java</artifactId> 
    <version>1.0.2</version> 
    <scope>test</scope> 
</dependency> 
<dependency> 
    <groupId>info.cukes</groupId> 
    <artifactId>cucumber-junit</artifactId> 
    <version>1.0.2</version> 
    <scope>test</scope> 
</dependency> 
<dependency> 
    <groupId>junit</groupId> 
    <artifactId>junit</artifactId> 
    <version>4.10</version> 
    <scope>test</scope> 
</dependency> 

JUnitのランナー:

import org.junit.runner.RunWith; 
import cucumber.api.CucumberOptions; 
@RunWith(Cucumber.class) 
@CucumberOptions(plugin={"pretty","html:reports/test-report"},tags= "@Smoketest") 
public class JunitRunner { 

} 

ケース2:のpom.xml

​​

JUnitはRuuner

とキュウリタグの問題に直面して1.2.2と

@RunWith(Cucumber.class) 
@CucumberOptions(plugin={"pretty","html:reports/test-report"},tags= "@Smoketest") 
public class JunitRunner { 

} 
下図のように:

Click the image

答えて

0

あなたはこれらの輸入品を使用する必要があります - -

import cucumber.api.java.en.Given; 
import cucumber.api.java.en.Then; 
import cucumber.api.java.en.When; 
+0

あなたが与えたパッケージは1.2.2用だと思います。私はcorectですか?はいの場合、キュウリのタグは問題ありませんが、Cucmber.classのJUnitランナーの設定に問題があります – Toothless

+0

あなたはどんなエラーを受けていますか – Grasshopper

+0

@RunWith(Cucumber.class)。この「Cucumber.class」では、「クラスはタイプされていません」というように表示されます。私はちょうど "cucumber.api.junit.Cucumber;"をインポートするのを見逃したパッケージを作成しましたが、これはマウスのホバーでインポートすることは推奨されませんでした。 – Toothless