在mstest中并行执行相同类中的测试 [英] parallel execution of tests in same class in mstest

查看:340
本文介绍了在mstest中并行执行相同类中的测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用MStest框架并行执行同一类中的测试用例. 我曾经使用过.runsettings(maxcpucount)文件和testsettings(paralleltestcount)文件,但是它们只是并行运行不同项目的测试.当我在同一个类中进行测试时,我无法实现这一点.

I am trying to execute test cases in same class parallely using MStest framework. I have used .runsettings(maxcpucount) file and testsettings(paralleltestcount) file but these are only running tests of different projects in parallel.I am unable to achieve this when I have tests in same class.

推荐答案

您应该可以通过以下方式更改运行设置来做到这一点.当您将范围级别定义为Method而不是ClassLevel时,您将能够并行运行同一类中存在的测试.

You should be able to do this, by changing your run setting the following way. When you define the scope level to Method instead of ClassLevel, you would be able to run tests present in same class in parallel.

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <!-- MSTest adapter -->
  <MSTest>
    <Parallelize>
      <Workers>10</Workers>
      <Scope>MethodLevel</Scope>
    </Parallelize>
  </MSTest

    >
    </RunSettings>

这篇关于在mstest中并行执行相同类中的测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆