【问题标题】:maven failsafe testng is not printing any sysouts or summariesmaven failsafe testng 没有打印任何系统输出或摘要
【发布时间】:2016-08-08 18:08:40
【问题描述】:

我正在使用 TestNG 和 maven 故障安全进行集成测试。

测试已执行并通过,但绝对没有打印出任何细节。

我什至创建了一个虚拟测试并在其中包含 System.out.println 并且没有打印出来。

<plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
            <executions>
                <execution>
                    <id>integration-tests</id>
                    <phase>integration-test</phase>
                    <goals>
                        <goal>integration-test</goal>
                    </goals>
                    <configuration>

                        <excludes>
                            <exclude>none</exclude>
                        </excludes>

                        <includes>
                            <include>**/*IntegrationTest.java</include>
                        </includes>

                        <properties>
                            <property>
                                <name>surefire.testng.verbose</name>
                                <value>10</value>
                            </property>
                        </properties>                           

                    </configuration>
                </execution>
                <execution>
                    <id>verify</id>
                    <goals>
                        <goal>verify</goal>
                    </goals>
                    <configuration>
                        <redirectTestOutputToFile>true</redirectTestOutputToFile>
                        <skip>false</skip>
                        <excludes>
                            <exclude>none</exclude>
                        </excludes>
                        <includes>
                            <include>**/*IntegrationTest.java</include>
                        </includes>
                    </configuration>
                </execution>
            </executions>
        </plugin>

我希望打印 testNG 摘要并打印日志语句 ...

我也在使用 groovy-eclipse-compiler 插件.. 不确定这是否会有所不同

【问题讨论】:

  • 你试过没有&lt;redirectTestOutputToFile&gt;true&lt;/redirectTestOutputToFile&gt;吗?

标签: java maven testng maven-failsafe-plugin


【解决方案1】:

当您使用测试框架时,您需要使用 maven surefire 插件来汇总您的结果。我不认为任何事情都是按照你现在的方式执行的,所以没有输出是预期的。

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.17</version>
                <configuration>
                    <suiteXmlFiles>
                        <suiteXmlFile>${basedir}/src/main/resources/testng.xml</suiteXmlFile>
                    </suiteXmlFiles>
                    <skipTests>${skipTests}</skipTests>
                    <testFailureIgnore>true</testFailureIgnore>
                </configuration>
            </plugin>

【讨论】:

  • surefire 用于单元测试。我正在做集成测试。测试正在执行并且正在通过。我可以在报告中看到它。问题在于测试的输出。如果你用谷歌搜索的话,有一整页关于运行带有故障保护的 testng 的页面
  • 所以它和我发布的这个小 xml 配置一样,除了没有摘要:fail-safe - true
猜你喜欢
  • 2016-06-20
  • 2016-01-04
  • 1970-01-01
  • 2013-06-20
  • 1970-01-01
  • 2023-04-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多