c# - 通过 visual studio 并行测试执行,测试被跳过

标签 c# testing selenium visual-studio-2013 mstest

我正在使用 VS2013,运行 120 个 c# selenium 测试,带有一个 .testsetting 文件,其中包含以下参数 Execution parallelTestCount="5"和 6000 毫秒(6 秒)的测试超时。 测试时间超过 6 秒,我使用此配置重现了问题。 6 秒后,5 个测试失败,其余测试被跳过。 这是我在输出窗口中得到的: “测试运行在 Machine-Name 上中止,挂起测试的数量超过允许的最大“5”。”

测试设置文件

  <?xml version="1.0" encoding="UTF-8"?>
    <TestSettings name="RemoteWebDriver" id="e293abd4-745a-43f5-a831-2064f9305fc6" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
      <Description>These are default test settings for a local test run.</Description>
      <Deployment>
        <DeploymentItem filename="TfsAutomation\testDefintionSources.config" />
        <DeploymentItem filename="TfsAutomation\TfsAutomationCore.config" />
      </Deployment>
      <Scripts setupScript="TestScriptRemoteWebDriver.bat" />
      <Execution parallelTestCount="5">
        <Timeouts runTimeout="10000000" testTimeout="6000" />
        <TestTypeSpecific>
          <UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
            <AssemblyResolution>
              <TestDirectory useLoadContext="true" />
            </AssemblyResolution>
          </UnitTestRunConfig>
        </TestTypeSpecific>
        <AgentRule name="LocalMachineDefaultRole">
        </AgentRule>
      </Execution>
      <Properties />
    </TestSettings>

最佳答案

这个问题让我想到了 this并且正在阅读一段时间。值得一提的是,MsTest 的内部结构从那时起并没有发生太大变化,至少根据上面的引用和我的知识。在不了解测试环境体系结构的内部结构的情况下,我只能得出结论说 MSTest 并行机制不适用于并行 UI 测试。其次,内核数量对 MsTest 并行执行中的并行性很重要。引用this SO answer查看有关线程管理的更多信息。 所以,问题是什么是最好的解决方案。如果对 MSTest 没有太多了解,但对 Selenium 有足够的了解,我会说 Selenium-Grid。让我们网格控制并行执行以确保安全。

关于c# - 通过 visual studio 并行测试执行,测试被跳过,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27589886/

相关文章:

java - TestNG 多次运行所有类方法,初步使用提供的数据执行@BeforeClass

python - 在Python中分割outerHTML属性

c# - 如何获得鼠标滚轮垂直滚动率

c# - Docker:将文件写入物理或共享路径,使用docker和netcore3.1

c# - ASMX 后响应正文缺少最后一个字符

unit-testing - 如何在另一个方法中 stub

C# 继承构建错误

c++ - 使用 cmake : how could I write a test to verify that a class is abstract?

javascript - Protractor - 访问元素时出现 "could not find testability for element"错误

java - 从 Selenium Java 测试脚本到 MySQL 数据库的连接失败