Eclipse 无法使用maven生成运行配置运行cucumber测试

Eclipse 无法使用maven生成运行配置运行cucumber测试,eclipse,selenium-webdriver,maven-2,cucumber-jvm,Eclipse,Selenium Webdriver,Maven 2,Cucumber Jvm,我正在尝试使用maven build as run配置在eclipse中运行cucumber测试。 当我运行配置时,构建正在获得成功,但浏览器没有调用。因此,测试没有运行。 测试被跳过,没有提供任何可编译的信息-所有类都是最新的。 通过运行特性文件作为cucumber特性,我能够成功地运行相同的测试 请告诉我为什么跳过测试。还让我知道在maven构建时运行cucumber测试的步骤。 下面是我正在使用的pom.xml。 此外,我还将vm参数用作-Dcucumber.Options=-format

我正在尝试使用maven build as run配置在eclipse中运行cucumber测试。 当我运行配置时,构建正在获得成功,但浏览器没有调用。因此,测试没有运行。 测试被跳过,没有提供任何可编译的信息-所有类都是最新的。 通过运行特性文件作为cucumber特性,我能够成功地运行相同的测试

请告诉我为什么跳过测试。还让我知道在maven构建时运行cucumber测试的步骤。 下面是我正在使用的pom.xml。 此外,我还将vm参数用作-Dcucumber.Options=-format html:target/cucumber html report-tags@Runme

<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>Maven.Project</groupId>
  <artifactId>testMaven</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>Maven.Project-v1-testMaven</name>


    <properties>
        <corporate.test.url>http://google.com</corporate.test.url>
        <corporate.test.browser>Firefox</corporate.test.browser>
        <corporate.selenium.url>http://localhost:8888/wd/hub</corporate.selenium.url>
    </properties>

  <dependencies>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>1.1.8</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>info.cukes</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>1.1.8</version>
            <scope>test</scope>
        </dependency>
        <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>2.42.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>commons-configuration</groupId>
            <artifactId>commons-configuration</artifactId>
            <version>1.9</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-exec</artifactId>
            <version>1.1</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>test</id>
            <properties>
                <corporate.test.url>http://acc-about.hm.com</corporate.test.url>
                <corporate.test.browser>Firefox</corporate.test.browser>
                <corporate.selenium.url>http://localhost:8888/wd/hub</corporate.selenium.url>
            </properties>
        </profile>
    </profiles>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.10</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>
        </plugins>
        <testResources>
            <testResource>
                <directory>src/test/resources</directory>
                <filtering>true</filtering>
            </testResource>
        </testResources>
    </build>


</project>

请删除maven-surefire插件中的skiptests标记

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
       <skipTests>true</skipTests>
</configuration>
编辑: 请在配置中添加以下行

<suiteXmlFiles>
    <suiteXmlFile>${basedir}${suiteFile}</suiteXmlFile>
</suiteXmlFiles>
<reportsDirectory>./test-output/archive/${timestamp}</reportsDirectory>
在这里,suiteXmlFile指向您试图运行的xml文件,reportsDirectory指向您的输出文件夹。在命令行中,或者如果在目标中使用eclipse,则提供干净的测试-DsuiteFile=


希望这会有所帮助。

删除skiptest后,将运行0测试。测试运行:0,失败:0,错误:0,跳过:0Hi@shruti…我已经更新了答案,请检查并让我知道。谢谢Vivek。我现在可以运行测试了。这个问题与命名约定有关。虽然我使用的是surefire插件,但测试应该以test结束。不知何故,我没有在intelliJ上面对这个问题,但它发生在Eclipse上。很抱歉,我没有得到u…测试在某种意义上应该以测试结束?例如,您的runner类文件应命名为CukeRunnerTest.javaYou能否显示项目的包结构以及测试运行程序和功能文件所在的位置?我无法上载图像,因为此处的声誉较低。但我已经在src/test/resources下创建了功能文件,在src/test/java下创建了步骤定义和运行器类文件。