TestNG报告未显示超过21项测试

时间:2016-08-15 19:53:59

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

我有一个通过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>

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

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

相关问题