TLDR - 当我运行一个并行启用的大型硒测试套件时,一堆测试方法“消失” - 它们不再被报告为通过,失败或跳过,只是看似已经消失 . 我希望有人能够提供一些关于如何解决问题的指示 .

当我正常运行我的测试装置时,大约需要10个小时(ergh),只有不到800个单独的测试 . 它通常通过maven和surefire运行,其中包含类似这样的suite.xml文件......

<suite name="MainSuite" time-out="1800000" verbose="10">
  <listeners>
    <listener class-name="com.example.selenium2webdriver.testng.listener.StatsdSuiteListener"/>
  </listeners>
  <test name="AllTests">
    <groups>
      <run>
        <exclude name="windowsonly"/>
        <exclude name="upgrade"/>
      </run>
    </groups>
    <packages>
      <package name="com.example.selenium.*"/>
      <package name="com.example.selenium2webdriver.tests.*"/>
    </packages>
  </test>
</suite>

我得到一个surefire-reports / testng-results.xml文件,它以这样的东西开头......

<testng-results skipped="7" failed="8" total="789" passed="774">
  <reporter-output></reporter-output>
  <suite name="MainSuite" duration-ms="35693671" started-at="2016-12-28T08:49:22Z" finished-at="2016-12-28T18:44:16Z">

现在,问题 . 如果我将 parallel="methods" thread-count="2" 添加到套件声明中以期加快整体运行时间,我现在在surefire-reports / testng-results.xml文件的顶部看到以下内容......

<testng-results skipped="5" failed="9" total="45" passed="31">
  <reporter-output></reporter-output>
  <suite name="MainSuite" duration-ms="1818150" started-at="2017-01-08T08:50:25Z" finished-at="2017-01-08T09:20:43Z">

当然,它的速度要快得多,但突然之间我只看到大约5%的测试被报告(并且查看目标机器表明丢失的测试实际上没有被运行) .

所以,我的问题,毕竟是'当我启用并行模式时,我怎么能确保我的所有测试仍然运行'?或者,如果没有一个简单的答案,我怎么能进一步解决这个问题,或者解决我的设置中的问题,或者将其提炼成可以报告的可重现的bug .


一些随机的其他背景/信息,以防它们相关/有用 .

我正在使用TestNG 6.10,(并且还在6.9.10上看到了这一点) .

为了能够提供更可重复的示例,我使用javaparser来删除所有实际的测试方法内容(留下注释等) . 生成的测试集只需几秒钟即可完成所有操作,无论并行配置如何,都不会再出现问题 . 我想这表明问题是时间特定的,或者测试中的某些东西会引发问题 .

并行运行的具体测试不一致,计数也不一致 . 在几次运行中,我看到最多总共达到100左右 .

仔细观察surefire-reports / testng-results.xml文件,/ testng-results / suite / groups / group似乎确实列出了测试方法...例如,我看到......

<group name="DeleteCollectionCLI">
  <method signature="DeleteCollectionCLI.deleteCollectionfromCLI()[pri:0, instance:com.example.selenium.cli.DeleteCollectionCLI@e3c0e40]" name="deleteCollectionfromCLI"class="com.example.selenium.cli.DeleteCollectionCLI"/>
</group>
<!--  DeleteCollectionCLI  -->

...但是该类和该方法都没有在结果的/ testng-results / suite / test部分下表示