Mestest ParallelTestCount does not test on tests

I run my unit tests on a test agent. I changed my settings to use ParallelTestCount = "0", so the tests run in parallel. I then have tests with an error, since the tests use the same instance of Mock.

In any case, can I run each test class in parallel, rather than separate tests?

Is there a better alternative to the MSTEST command line to check my binaries?

I am running Visual Studio 2012 and TestAgent and controller 2012.

Thanks in advance

+4
source share
1 answer

There is no such option, as far as I know.

These failed tests actually show that you have a common state between your unit tests - in this case, the class field (mock).

Consider creating shared objects in each test instead of using TestInitialize to create a layout if it is complete, then use a helper method.

I do not recommend splitting tests between the two methods, and I think that this minimal code duplication not only ensures that you have no common condition, but also creates more readable tests and ensures that accidentally editing your initialization method will benefit from not invoking other tests.

For more information on why I prefer not to use SetUp / TestInitialize, check out James Newkirk's blog or my own thoughts on this .

0
source

Source: https://habr.com/ru/post/1499567/


All Articles