Multi-thread fakes

Top  Previous  Next

Running in a mutli-thread environment

 

By default, Isolator++ Professional will fake methods across all threads in your application. This ensures that the behavior of your fakes is consistent regardless of which thread is executing the code. However, in some scenarios, you may want to restrict faking to only the test thread to avoid interference with other threads.

 

To override the default behavior and limit faking to the test thread only, you can use the following configuration:

 

 

   // Arrange

   auto a = Isolator(IsolatorConfiguration::FakeOnlyOnTestThread);  

 

 

This configuration ensures that all fake methods are only active on the test thread. Any methods called on other threads will behave as if no fakes were applied, maintaining the integrity of your multi-threaded environment.

 

 


Copyright  Typemock Ltd. 2009-2025.  All Rights Reserved.