Serenity Cucumber:测试在第一次失败时退出,报告为空

时间:2017-08-07 21:13:12

标签: java eclipse cucumber

大家。 我使用宁静+黄瓜面临一个问题:我经营maven"清洁验证"我的项目的任务(使用eclipse IDE),当第一个测试用例失败时,执行被中止。

这是pom.xml:

  

http://maven.apache.org/xsd/maven-4.0.0.xsd">       4.0.0

[^[:alnum:]]

这里是错误的样子:

<groupId>br.jus.tjpb.testes.fta</groupId>
<artifactId>estudos</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>

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

<properties>
    <junit.version>4.12</junit.version>
    <selenium.version>3.4.0</selenium.version>
    <serenity.version>1.5.3</serenity.version>
    <slf4j.version>1.8.0-alpha2</slf4j.version>
    <cucumber.version>1.2.5</cucumber.version>
    <serenity.cucumber.version>1.5.4</serenity.cucumber.version>
    <!-- BUILD -->
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <surefire.version>2.19.1</surefire.version>
    <failsafe.version>2.19.1</failsafe.version>
    <compiler.version>3.5.1</compiler.version>
    <!-- TAGS -->
    <tags>SistemaCompleto</tags>
    <webdriver.driver>firefox</webdriver.driver>
</properties>

<profiles>
    <profile>
        <id>win</id>
        <properties>
            <geckodriver.path>C:\\geckodriver\\geckodriver.exe</geckodriver.path>
        </properties>
    </profile>
    <profile>
        <id>linux</id>
        <properties>
            <geckodriver.path>/ambiente/conf/geckodriver</geckodriver.path>
        </properties>
    </profile>
</profiles>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>${junit.version}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>${selenium.version}</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>${selenium.version}</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-core</artifactId>
        <version>${serenity.version}</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>${serenity.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.8.0-alpha2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-core</artifactId>
        <version>${cucumber.version}</version>
    </dependency>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-java</artifactId>
        <version>${cucumber.version}</version>
    </dependency>
    <dependency>
        <groupId>info.cukes</groupId>
        <artifactId>cucumber-junit</artifactId>
        <version>${cucumber.version}</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-cucumber</artifactId>
        <version>${serenity.cucumber.version}</version>
    </dependency>
</dependencies>

<build>
    <resources>
        <resource>
            <directory>src/test/java</directory>
            <includes>
                <include>**/*.properties</include>
            </includes>
        </resource>
    </resources>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${surefire.version}</version>
            <configuration>
                <testFailureIgnore>true</testFailureIgnore>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <version>${failsafe.version}</version>
            <configuration>
                <includes>
                    <include>**/*.java</include>
                </includes>
                <reuseForks>true</reuseForks>
                <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
                <systemPropertyVariables>
                    <tags>${tags}</tags>
                    <webdriver.driver>${webdriver.driver}</webdriver.driver>
                    <webdriver.gecko.driver>${geckodriver.path}</webdriver.gecko.driver>
                    <webdriver.timeouts.implicitlywait>30</webdriver.timeouts.implicitlywait>
                </systemPropertyVariables>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>integration-test</goal>
                        <goal>verify</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${compiler.version}</version>
            <configuration>
                <source>${java.version}</source>
                <target>${java.version}</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>
            <artifactId>serenity-maven-plugin</artifactId>
            <version>${serenity.version}</version>
            <dependencies>
                <dependency>
                    <groupId>net.serenity-bdd</groupId>
                    <artifactId>serenity-core</artifactId>
                    <version>${serenity.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <id>serenity-reports</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>aggregate</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

    </plugins>
</build>

这是报告生成状态:

Failed tests: expected:<[]-Menor que 18 anos: ...> but was:<[duvida]-Menor que 18 anos: ...>

我看到了关于serinity + cucumber报告的一些错误,但是他们提出的解决方案并没有解决我的问题。

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

依赖项是POM.xml中的插件:

<plugin>
            <groupId>net.serenity-bdd.maven.plugins</groupId>
            <artifactId>serenity-maven-plugin</artifactId>
            <version>${serenity.version}</version>
            <dependencies>
                <dependency>
                    <groupId>net.serenity-bdd</groupId>
                    <artifactId>serenity-core</artifactId>
                    <version>${serenity.version}</version>
                </dependency>
            </dependencies>

依赖项应该在其余依赖项之间 。 。 。 。

尝试删除该依赖项并将其传递到依赖项中,而不是插件部分。