Typemock Isolator™ Overview

Programmers who have incorporated unit testing into their development process are aware of its advantages: cleaner code, courage to refactor, and higher development speed. But even the most die-hard unit testers can falter when faced with testing a class that relies on a system's state for its behavior.

Many developers have seen the improvement in quality and increase in speed that comes from having a comprehensive unit-test suite. But writing good unit tests takes time and effort. Because each unit cooperates with others, writing a unit test can involve a significant amount of setup code. This makes tests more expensive, and in certain cases they can be almost impossible to implement, especially when a method depends on other hard-to-control things like the network, a database, or even the current weather temperature.

To support testing you need to isolate parts of the code and fake their behavior. To test how an application handles a network being disconnected, it is necessary to isolate the class that deals with the network and fake an error returned from a call to the network. This is exactly what Isolator does. It enables programmers to replace the 'real' application behavior with the one required by the test. Only, it does this without changes to the code-under-test.

Typemock Isolator gives you the power to isolate static and nonvirtual methods and future instances without having to refactor or change your production code. Unlike any other frameworks, your tests will be much clearer and you will be able to write them much faster.

Typemock Isolator supports three sets of API in order to fake dependecies:

With AAA Syntax it is much simpler to define and create tests that require isolating other parts of the code. Although AAA Syntax is easier and contains more features, it does not cover all scenarios for now, and Natural or Reflective Mocks are there to help with their existing features. The sets of API can work together to complement each other.

The following is a comparison between AAA, Natural Mocks™ and Reflective Mocks syntax:

Feature

AAA (C# & VB)

Reflective Mocks

Natural Mocks™
Compile time checks Yes No (methods are passed as strings) Yes
Refactoring support Yes Partial (methods are passed as strings) Yes
Fake recursive objects Yes No No
Static method behavior setting and verification Yes Yes Yes
Non-public methods mocking Yes Yes Partial (with MS private accessors)
Collection swapping Yes (C# only) No No
Call verification Yes Yes Yes
Argument checking Yes Yes Yes
Setting calls to behave as original Yes Yes Yes
Method Redirection (duck-typing) Yes No No
Custom argument checking Yes Yes Yes
Conditional execution of custom code Yes Yes Yes
Repeating expectations Yes Yes Yes
Faking all instances Yes Yes Yes
Conditional expectations Yes Yes Yes
True Indexers Yes No No
True Properties Yes No No

 


Copyright © Typemock Ltd. 2004-2010. All Rights Reserved.