chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Hi,

I have some unit tests that cannot be run in conjunction with Isolator, due to a 3rd party component including encrypted MSIL (I get a "Common Language Runtime detected an invalid program" exception).

These tests run fine if I disable Isolator within Visual Studio. However, I want these tests to run as part of a larger suite (which requires Isolator) on my build server. So I was hoping I could programmatically disable Isolator just for the problem tests.

I tried Environment.SetEnvironmentVariable("Cor_Enable_Profiling", "0x0") in the test setup, but that didn't work. Is there anything else I can do?

For info, the tests are running via ReSharper within VisualStudio and within the TeamCity NUnit test runner on the build server.

Thanks
Akash
asked by barrhibb (600 points)

1 Answer

0 votes
Hi

If you are running the tests using TMockRunner.exe you can use NUnit [Category] attribute together with the /include /exclude command line option of nunit-console.exe to run different set of tests.
Example:

[Test]
[Category("NoIsolator")]
public void TestWithoutIsolator()
{
}


First run tests with Isolator:
TMockRunner.exe nunit-console.exe /exclude="NoIsolator" MyTests.dll


Second run tests without Isolator:
nunit-console.exe /include="NoIsolator" MyTests.dll


If you are using MSBuild task you can use the TypeMockStop task
See the documentation here for details.
answered by ohad (35.4k points)
...