2016-10-24 22 views
0

私は2日以来これと戦ってきました。私のテストは合格と表示されますが、テストはセルニウムのwebdriverテストのためにキュウリ+ javaで実行されていません。コンソールでは、私はまた、プロジェクトシナリオを取得し、Javaでキュウリで未定義のステップ

のディレクトリ構造と機能のファイルのスクリーンショットを添付すれば、以下の通りランナークラス

package stepDefinition; 
import org.junit.runner.RunWith; 

import cucumber.api.CucumberOptions; 
import cucumber.api.junit.Cucumber; 


@RunWith(Cucumber.class) 
@CucumberOptions(
     monochrome=true, 
     features = "src/main/resources/feature", 
    glue="src/test/java/stepDefinition", 
    tags={"@tag2"}, 
    dryRun = false) 
public class TestRunner { 
} 

1 Scenarios (1 undefined) 
4 Steps (4 undefined) 
0m0.000s 


You can implement missing steps with the snippets below: 

@Given("^User navigate to shopping page$") 
public void user_navigate_to_shopping_page() throws Throwable { 
    // Write code here that turns the phrase above into concrete actions 
    throw new PendingException(); 
} 

@When("^user enters data$") 
public void user_enters_data() throws Throwable { 
    // Write code here that turns the phrase above into concrete actions 
    throw new PendingException(); 
} 

@When("^clicks on search button$") 
public void clicks_on_search_button() throws Throwable { 
    // Write code here that turns the phrase above into concrete actions 
    throw new PendingException(); 
} 

@Then("^product should be displayed$") 
public void product_should_be_displayed() throws Throwable { 
    // Write code here that turns the phrase above into concrete actions 
    throw new PendingException(); 
} 

は私が書いたメッセージ次

される取得しています
[![Feature: Checking Functionality 
This is a demo test 

@tag2 
Scenario: Test Login 
    Given User navigate to shopping page 
    When user enters data 
    And clicks on search button 
    Then product should be displayed 

enter image description here

+0

/testブランチの下で機能を移そうとしましたか?また、intelliJでは、モジュールの設定やテストフォルダ、コードフォルダのマークを設定することができますが、Eclipseには同じことがありますか? – Morvader

+0

私はフィーチャーファイルをテストしましたが役に立たなかった:(私はあなたの2番目の質問についてはわかりません –

答えて

0

あなたはグルーの値を与えた方法が間違っています。 Javaパッケージ形式で提供する必要があります。代わりにglue = "stepDefinition"を試してください。内部のパッケージを持っていた場合

は、あなたの現在のstepDefinitionパッケージには、は、コードを持っているステップ言うことができます。次に接着剤は"stepDefinition.steps"

になります。あなたの機能は、test \ resourcesフォルダに移動する必要があります。

1

難しい問題を解決しようとしています。つまり、あなたは働いたことのないものを修正しようとしています。

私のアプローチは、うまくいくものから始め、そのユースケースをサポートするまで、その解決策を変換することです。私は何をすればよいかわからない場合、非常に小さな手順でそれを行います。

作業開始点は、キュウバーチームによって提供されるJavaスケルトンです。クローン/ダウンロードはこちらから:https://github.com/cucumber/cucumber-java-skeleton

+0

フィーチャーファイルを正常に実行できましたが、現在走っているランナーファイルは実行できません –

関連する問題