分享

Run Unit Tests in Parallel using Visual Studi...

 Wiley Library 2013-05-22

Run Unit Tests in Parallel using Visual Studio 2010

Run Unit Tests in Parallel using Visual Studio 2010

Today almost each and every machine have multiple CPU’s or a CPU with multiple cores, so why not using them in order to speed up your tests runs and run more Tests in parallel.

In Visual Studio 2010 Microsoft added the ability to run Tests (Only for Unit Tests) in parallel.

  • Data Collectors cannot be enabled if using Parallel execution.
  • You must have multi-core/CPU machine

image

How To Enable Parallel Execution of Unit Tests

1. Create new Test Project in Visual Studio 2010

2. Right click on “Local.testsettings” and click “Open With”, choose “Xml (Text) Editor” and hit OK.

image

image

3. Expand the Execution Tag and add additional attribute called – parallelTestCount:

What’s are your options:

  • 0 = Auto configure: We will use as many tests as we can based on your CPU and core count
  • Define the number of tests to run in parallel – If you don’t want to use all cores/cpu’s

image

 

This is my code for that Demo:

image

As you can see from the picture below I have 4 unit tests running in parallel and another picture below you can see my computer finally working Smile

image

image

Enjoy

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多