locked
parallel execution of tests in same class in mstest RRS feed

  • Question

  • I want to execute test Methods in same class parallely using MStest framework. I have tried using .runsettings(maxcpucount) file /testsettings(paralleltestcount) file but these are only running test methods present in different projects in parallel.I am unable to achieve parallel execution of tests in same class .

    Wednesday, February 17, 2016 10:48 PM

Answers

  • Hi Chhavi Kothari,

    Thanks for your update.

    >>My unit tests are in same class and this doesn't seem to work in this case

    As far as I know, we can't run the test in parallel, if the test methods are in same class.

    >>I am using selenium tests and want to run test against multiple browsers in parallel.

    And Since our forum is discussing about Unit Test. If you were doing selenium automation test. I suggest you could post it to the selenium forum for better support.

    https://groups.google.com/forum/#!forum/selenium-users

    Thanks for your understanding.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Lake Xiao

    • Proposed as answer by lake Xiao Monday, February 22, 2016 1:48 AM
    • Marked as answer by lake Xiao Monday, February 29, 2016 3:15 AM
    Friday, February 19, 2016 1:59 AM

All replies

  • Hi Chhavi Kothari,

    Thanks for your post.

    As far as I know, if you want to execute Unit Tests in parallel. First requirement is that your machine has multiple CPU’s or a CPU with multiple cores.

    Then you could create a test setting file and select open with, and open as XML. Set the parallelTestCount attribute on the Execution element.

    Please take a look at the following screenshot:

    For the detailed information, please refer to the following blog about "Executing Unit Tests in parallel on a multi-CPU/core machine":

    http://blogs.msdn.com/b/vstsqualitytools/archive/2009/12/01/executing-unit-tests-in-parallel-on-a-multi-cpu-core-machine.aspx

    After setting this element. You can run the test using this test setting file in IDE directly. Or if you want to run via MSTEST. You could enter the following command line in the Developer Command Prompt:

    MSTEST /testcontainer:testit.dll /testsettings:Local.Testsettings

    Hope that could be helpful to you.

    Best Regards,

    Lake Xiao

    Thursday, February 18, 2016 6:30 AM
  • Hi Lake,

    Thanks for your reply.
    I have tried using parallelTestCount=5 in test settings file but this only works if i have my unit tests in separate projects.

    My unit tests are in same class and this doesn't seem to work in this case .My test are running sequentially even after specifying paralleltestcount in testsettings file.

    Regards,

    Chhavi

    Thursday, February 18, 2016 5:17 PM
  • I am using selenium tests and want to run test against multiple browsers in parallel.
    Thursday, February 18, 2016 5:36 PM
  • Hi Chhavi Kothari,

    Thanks for your update.

    >>My unit tests are in same class and this doesn't seem to work in this case

    As far as I know, we can't run the test in parallel, if the test methods are in same class.

    >>I am using selenium tests and want to run test against multiple browsers in parallel.

    And Since our forum is discussing about Unit Test. If you were doing selenium automation test. I suggest you could post it to the selenium forum for better support.

    https://groups.google.com/forum/#!forum/selenium-users

    Thanks for your understanding.

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.

    Microsoft does not control these sites and has not tested any software or information found on these sites;

    Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.

    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.

    Best Regards,

    Lake Xiao

    • Proposed as answer by lake Xiao Monday, February 22, 2016 1:48 AM
    • Marked as answer by lake Xiao Monday, February 29, 2016 3:15 AM
    Friday, February 19, 2016 1:59 AM