【问题标题】:TestNG Report is not displaying more than 21 testsTestNG 报告未显示超过 21 个测试
【发布时间】:2016-08-15 19:53:58
【问题描述】:

我有一个通过 Testng xml 运行 testNG 测试的 maven 项目。 XML 有以下监听器

<listener class-name="org.uncommons.reportng.HTMLReporter" /> 
<listener class-name="org.uncommons.reportng.JUnitXMLReporter" />

我在 xml 中有 24 个测试,所有测试都运行包,例如

<test name="First Test"
    preserve-order="true">
    <packages>
        <package
            name="testProject.first.*" />
    </packages>
</test>

由于某种原因,所有 24 个测试都运行,但在 testng 报告中我只看到 21 个测试。显示的 21 个测试并不总是一致的,因此排除了某些测试设置存在问题的可能性。我想知道是否可能运行最大数量的测试以及是否需要组合测试?或者是否可以在某处设置最大数量的测试参数?

以下是我的 maven-surefire-plugin 设置

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.12</version>
                <configuration>
                    <properties>
                        <property>
                            <name>usedefaultlisteners</name>
                            <value>false</value>
                        </property>
                        <property>
                            <name>listener</name>
                            <value>org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter</value>
                        </property>
                        <systemPropertyVariables>
                            <environment>${env.browser}</environment>
                        </systemPropertyVariables>
                        <systemPropertyVariables>
                            <environment>${env.environment}</environment>
                        </systemPropertyVariables>
                        <systemPropertyVariables>
                            <environment>${env.testlinkRelease}</environment>
                        </systemPropertyVariables>
                    </properties>
                    <suiteXmlFiles>
                        <suiteXmlFile>src/testCleanup/${cleanup.suite}</suiteXmlFile>
                        <suiteXmlFile>src/limelightTests/${test.suite}</suiteXmlFile>
                    </suiteXmlFiles>
                </configuration>
            </plugin>

感谢您的帮助。

【问题讨论】:

  • 你能显示你的&lt;maven-surefire-plugin&gt; 配置吗?
  • @Hatley 将信息添加到我的问题中
  • 获得解决方案的最佳方法始终是添加一个简单的项目,将您的问题复制到 github..从上面不清楚问题可能出在哪里。如果您能够将最少的代码/项目添加到 github 以复制您的问题

标签: maven selenium testng maven-surefire-plugin reportng


【解决方案1】:

我发现了问题。我有一个在 @AfterMethod 运行后运行的屏幕截图监听器。 @AfterMethod 退出驱动程序,因此屏幕截图侦听器最终抛出了一个未被捕获的错误并导致测试被排除在报告之外。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    • 2019-07-23
    • 2019-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多