首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法使用java和Maven运行简单的黄瓜程序

无法使用java和Maven运行简单的黄瓜程序
EN

Stack Overflow用户
提问于 2017-09-02 20:04:21
回答 1查看 390关注 0票数 1

特性文件中的错误:

代码语言:javascript
复制
Unimplemented Subset definition

运行Testrunner类时出错

代码语言:javascript
复制
cucumber.runtime.CucumberException: Error parsing feature file search.feature

我使用Intellij,创建了Maven项目,并在下面设置代码。我已经检查了子集插件,它似乎安装了最新版本的intelliJ。

已经尝试了与堆栈溢出的其他问题不同的答案,但仍然无法运行它。

TestRunner.java

代码语言:javascript
复制
package runner;

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


    @RunWith(Cucumber.class)
    @CucumberOptions(features="src/test/resources/features/",glue={"stepDefinition"})

       public class TestRunner{



    }

SmokeTest.java

代码语言:javascript
复制
package stepDefinition;

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

    public class SmokeTest {


        @Given("^I am on the home page$")
        public void iAmOnTheHomePage() throws Throwable {
            System.out.println("1");
        }

        @When("^I select to search for game$")
        public void iSelectToSearchForGame() throws Throwable {
            System.out.println("2");
        }



        @Then("^I get the search results with game names at the top$")
        public void iGetTheSearchResultsWithGameResultsAtTheTop() throws Throwable {
            System.out.println("3");
        }
    }

特性:

代码语言:javascript
复制
Feature : search

Scenario : Searching as a Global user
   Given I am on the home page
   When I select to search for game
   Then I get the search results with game names at the top

POM.xml :

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<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.demo.cucumber</groupId>
    <artifactId>com.demo.cucumber</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
    <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-junit -->
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>1.2.2</version>
        <scope>test</scope>
    </dependency>

        <!-- https://mvnrepository.com/artifact/info.cukes/cucumber-java -->
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.2.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/junit/junit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.5.3</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-firefox-driver</artifactId>
            <version>3.5.3</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>htmlunit-driver</artifactId>
            <version>2.24</version>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-server</artifactId>
            <version>3.5.3</version>
        </dependency>

    </dependencies>


</project>

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-09-02 20:45:03

问题来自Substeps IntelliJ Plugin,IntelliJ建议您在项目中找到.feature文件时安装它。

只需忽略这个扩展时,它弹出或卸载它,如果你已经有它。

Cucumber for JavaGherkin应该足够了。如果成功了就告诉我。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46017712

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档