Typemock and Design Issues

The new field mock feature that enables developers to mock fields has raised the questions:

Advocating Good Design

Well, lets get one thing straight. I do advocate good design, the design of the software is an important factor and one that I spend a lot of time on. I don’t advocate bad design. But this has nothing to do with testing tools.

Separation of Concerns

Mixing the abilities of tools is not a very good idea, I can give you numerous examples: One is my friends combined DVD/VCR that didn’t last long, the DVD had missing functionality that made the machine obsolete. Having your testing tool and design tool in one can lead to the same results.
I believe in Separation of Concerns - the testing tool should help you test your software and give you the confidence that you code works, it should not (as much as possible) force you (or help you) to design your code. The design tools (refactoring) should enable you to design your code in a better way, it should not test your code. Testing and Designing are different mind-sets. When you are testing your code, you are thinking about the external API and the scenario that you are testing - trying to make the code fail. This is a different mind set then when designing your code, where you need to see the higher picture and how to put all the pieces together. That is why TDD has 3 different steps:  Test, Code, Refactor! (Where Refactor is the Design process)

So what about mocking fields

Enabling Field Mocking comes from the same philosophy: Let the developer test his code. There is such a beast called “public fields” in .NET and there are some teams that use them and need to test their code. To give them confidence in there code, we can create pragmatic tools that will enable these team to test their code base and thus help these teams become more agile. If we tell these teams that they cannot test there code unless they conform to one certain design, these teams will not become agile as the bar is too high.

And what about design

There are many tools that developers can use to design there code (before or after writing tests), from static code analyzers like fxCop to refactor tools like Visual Studio and Resharper, and of course code reviews (and pair programming) which I believe are the best tools for design.

Once you separate the testing phase from the design phase you will have the freedom to make the correct balance and thus the best design, Typemock actually helps you get BETTER designed software. As long as you start thinking about the design seriously (by ruthlessly refactoring) and stop relying on your testing tool to do your design for you.

Bookmark at:
Add 'Typemock and Design Issues' to Del.icio.us Add 'Typemock and Design Issues' to digg Add 'Typemock and Design Issues' to reddit Add 'Typemock and Design Issues' to Feed Me Links! Add 'Typemock and Design Issues' to Technorati Add 'Typemock and Design Issues' to Yahoo My Web Add 'Typemock and Design Issues' to Newsvine Add 'Typemock and Design Issues' to FURL Add 'Typemock and Design Issues' to blinklist Add 'Typemock and Design Issues' to My-Tuts 

7 February 2008 | Uncategorized, Reviews | No Comments | Print This Post

Decorator feature enhancement

[Cross Posted in TypeMock Insider Blog]

Typemock-Isolator has a little know Decorator feature that allows developers to simply add capabilities to their test framework (all test framework).

Using this feature Typemock-Isolator creates the [VerifyMocks] decorator that automatically verifies the mocks at the end of your tests.

To create a custom decorator simply extend the DecoratorAttribute and implement the Execute method.

public override object Execute()

{

    // Trace start of method

    Console.WriteLine(“Entering Method:”+

     OriginalMethod.ToString());

    // Execute the original method

    return base.CallDecoratedMethod();

}

To support multiple decorators on the same test method, Typemock-Isolator makes sure that even if a developer forgot to call CallDecoratedMethod() the test method will still run. This is done by calling the decorated method if it wasn’t explicitly called.

We discovered that some Decorator implementers want more control and need to explicitly make sure that the test method was NOT called.

A new API was added in version 4.2 to do just that.

DontCallDecoratedMethod()

Once this is called (inside Execute), the decorator mechanism will not call the test method.

Of course if there is another decorator on the test method that calls CallDecoratedMethod() the test method will be executed.

Bookmark at:
Add 'Decorator feature enhancement' to Del.icio.us Add 'Decorator feature enhancement' to digg Add 'Decorator feature enhancement' to reddit Add 'Decorator feature enhancement' to Feed Me Links! Add 'Decorator feature enhancement' to Technorati Add 'Decorator feature enhancement' to Yahoo My Web Add 'Decorator feature enhancement' to Newsvine Add 'Decorator feature enhancement' to FURL Add 'Decorator feature enhancement' to blinklist Add 'Decorator feature enhancement' to My-Tuts 

7 February 2008 | .NET Tests | No Comments | Print This Post

Tips and Tricks

I am happy to announce that we have opened a Typemock Blog rss The blog will host posts from Typemock developers and will give inside information and tip and tricks.

Lior Friedman has already posted a explanation of the difference between Mock and MockObject

Bookmark at:
Add 'Tips and Tricks' to Del.icio.us Add 'Tips and Tricks' to digg Add 'Tips and Tricks' to reddit Add 'Tips and Tricks' to Feed Me Links! Add 'Tips and Tricks' to Technorati Add 'Tips and Tricks' to Yahoo My Web Add 'Tips and Tricks' to Newsvine Add 'Tips and Tricks' to FURL Add 'Tips and Tricks' to blinklist Add 'Tips and Tricks' to My-Tuts 

7 February 2008 | .NET Tests | No Comments | Print This Post

Typemock Isolator - Beta - Better Community

The Typemock team has released our next version of TypeMock.NET.image

We are calling it Typemock-Isolator. As Typemock helps developers Isolate their code from the rest of the system and make it Testable.

The main reason behind this are our plans to create more tools that will help simplify writing unit tests.

The Brain-Storming sessions behind this name where fun and we actually decided on a name, coded it in and then changed the name a few times after that (talk about agile teams). But the team took these changes really well!

Roy and Paulo have already talked about some new features.
Mainly Better Debugger Integration and Mocking Fields!!!

We have decided to add more features to our Community Edition and some features that were in the Professional Edition and can now be used in the Community Edition

  1. Mocking using Generic Code Sugar
  2. Mock mockControl = MockManager.Mock<ClassToMock>();

     

  3. Integrated Visual Studio Help can now be downloaded by all Typemock-Isolator users
  4. Per your request*: The annoying feedback screen while in evaluation, has been removed.

 

* The majority of feedbacks we received was to remove the Feedback Screen ;-)

Bookmark at:
Add 'Typemock Isolator - Beta - Better Community' to Del.icio.us Add 'Typemock Isolator - Beta - Better Community' to digg Add 'Typemock Isolator - Beta - Better Community' to reddit Add 'Typemock Isolator - Beta - Better Community' to Feed Me Links! Add 'Typemock Isolator - Beta - Better Community' to Technorati Add 'Typemock Isolator - Beta - Better Community' to Yahoo My Web Add 'Typemock Isolator - Beta - Better Community' to Newsvine Add 'Typemock Isolator - Beta - Better Community' to FURL Add 'Typemock Isolator - Beta - Better Community' to blinklist Add 'Typemock Isolator - Beta - Better Community' to My-Tuts 

6 February 2008 | Product, Release | 2 Comments | Print This Post

TypeMock Ltd has Secured $1.5M

I am delighted to announce that TypeMock has managed to secure $1.5M.

We have had an excellent year, and have imageseen how unit testing is starting to become a main trend in writing software. There are still many problems to solve in this area and we have raised the money to create new tools and solutions for the community as well as innovate and push developer testing to a new level.

At this point I am going to be taking the position of the CEO. I still have a sweet spot for coding and will stay tuned to all the technologies and will post features on this blog. TypeMock has already become a very strong team and you will be hearing about our new tools in the near future.

Happy new year

Bookmark at:
Add 'TypeMock Ltd has Secured $1.5M' to Del.icio.us Add 'TypeMock Ltd has Secured $1.5M' to digg Add 'TypeMock Ltd has Secured $1.5M' to reddit Add 'TypeMock Ltd has Secured $1.5M' to Feed Me Links! Add 'TypeMock Ltd has Secured $1.5M' to Technorati Add 'TypeMock Ltd has Secured $1.5M' to Yahoo My Web Add 'TypeMock Ltd has Secured $1.5M' to Newsvine Add 'TypeMock Ltd has Secured $1.5M' to FURL Add 'TypeMock Ltd has Secured $1.5M' to blinklist Add 'TypeMock Ltd has Secured $1.5M' to My-Tuts 

1 January 2008 | Community | No Comments | Print This Post

A Big Welcome to Roy Osherove

imageI would personally like to give Roy a big welcome to the TypeMock team.

I have worked with Roy while introducing TDD to an enterprise ‘legacy’ software company and have been wanting to work with Roy even since.

Roy has decided to join TypeMock at an excellent time, and will bring his expertise to help us produce better tools and promote pragmatic unit testing throughout the .net software industry.

Good Luck Roy.

Bookmark at:
Add 'A Big Welcome to Roy Osherove' to Del.icio.us Add 'A Big Welcome to Roy Osherove' to digg Add 'A Big Welcome to Roy Osherove' to reddit Add 'A Big Welcome to Roy Osherove' to Feed Me Links! Add 'A Big Welcome to Roy Osherove' to Technorati Add 'A Big Welcome to Roy Osherove' to Yahoo My Web Add 'A Big Welcome to Roy Osherove' to Newsvine Add 'A Big Welcome to Roy Osherove' to FURL Add 'A Big Welcome to Roy Osherove' to blinklist Add 'A Big Welcome to Roy Osherove' to My-Tuts 

1 January 2008 | Community | 1 Comment | Print This Post

Debugging Mocked Methods

Although strict XP practices, value tests more then debugging, there are many cases where you still have to debug the code base to find defects. Doing this with mocked objects can be very fishy.

Evaluating Mocked Properties

When evaluating methods and Properties in the Debugger, the Debugger Hi-Jacks the running application to run the code that evaluate the values. A mocking framework doesn’t know that you are running in the debugger and will return the mocked value. This might cause the test to fail, because of unexpected calls or different return values.

Breaking While Recording

When in Natural Mocks recording block, breaking inside the block will lead to very strange results. This is because the Hi-Jacked threads that are evaluating Properties are being recorded and mocked. The current workaround is to turn off automatic property evaluation.

Debugging Mocked Methods

When stepping into a mocked method, or putting a break point on it, you will never reach the break point. This is because the method is mocked and is never actually run. This is very confusing and I have heard some developers spending a lot of time trying to understand what is happening.

Preview

These issues have been a major feature of our coming TypeMock version and will all be solved.

Example of debugging a mocked method.

 image

As you can see, it is very easy to see that the method is mocked and understand why you cannot step into the method.

What do you think of the visual cue?

We are thinking about adding more information to the editor

What other information would you like to know while debugging?

Bookmark at:
Add 'Debugging Mocked Methods' to Del.icio.us Add 'Debugging Mocked Methods' to digg Add 'Debugging Mocked Methods' to reddit Add 'Debugging Mocked Methods' to Feed Me Links! Add 'Debugging Mocked Methods' to Technorati Add 'Debugging Mocked Methods' to Yahoo My Web Add 'Debugging Mocked Methods' to Newsvine Add 'Debugging Mocked Methods' to FURL Add 'Debugging Mocked Methods' to blinklist Add 'Debugging Mocked Methods' to My-Tuts 

26 December 2007 | Reviews, Product | 13 Comments | Print This Post

Welcome Ron Shoshani

imageI would like to welcome Ron Shoshani to our Team.
TypeMock is having a great year and we are growing, Ron will head the Marketing activities in TypeMock and will help introduce tools and techniques to developers around the world, enabling them and their teams to create quality software at speed times.

Welcome Ron! 

Bookmark at:
Add 'Welcome Ron Shoshani' to Del.icio.us Add 'Welcome Ron Shoshani' to digg Add 'Welcome Ron Shoshani' to reddit Add 'Welcome Ron Shoshani' to Feed Me Links! Add 'Welcome Ron Shoshani' to Technorati Add 'Welcome Ron Shoshani' to Yahoo My Web Add 'Welcome Ron Shoshani' to Newsvine Add 'Welcome Ron Shoshani' to FURL Add 'Welcome Ron Shoshani' to blinklist Add 'Welcome Ron Shoshani' to My-Tuts 

24 December 2007 | Community | No Comments | Print This Post

TypeMock Facebook

imageTypeMock now has a facebook page. The industry leaders are  already there. Don’t miss the party.

Click here to join the typemock group
or the typemock page.

Bookmark at:
Add 'TypeMock Facebook' to Del.icio.us Add 'TypeMock Facebook' to digg Add 'TypeMock Facebook' to reddit Add 'TypeMock Facebook' to Feed Me Links! Add 'TypeMock Facebook' to Technorati Add 'TypeMock Facebook' to Yahoo My Web Add 'TypeMock Facebook' to Newsvine Add 'TypeMock Facebook' to FURL Add 'TypeMock Facebook' to blinklist Add 'TypeMock Facebook' to My-Tuts 

24 December 2007 | Community | No Comments | Print This Post

TypeMock and Visual Studio 2008

imageAlthough we have supported visual studio 2008 since the Beta version I still think that it important to know that TypeMock supports visual studio 2008.

Bookmark at:
Add 'TypeMock and Visual Studio 2008' to Del.icio.us Add 'TypeMock and Visual Studio 2008' to digg Add 'TypeMock and Visual Studio 2008' to reddit Add 'TypeMock and Visual Studio 2008' to Feed Me Links! Add 'TypeMock and Visual Studio 2008' to Technorati Add 'TypeMock and Visual Studio 2008' to Yahoo My Web Add 'TypeMock and Visual Studio 2008' to Newsvine Add 'TypeMock and Visual Studio 2008' to FURL Add 'TypeMock and Visual Studio 2008' to blinklist Add 'TypeMock and Visual Studio 2008' to My-Tuts 

24 December 2007 | Release | No Comments | Print This Post

Search Eli Lopian’s Blog (TypeMock)

Navigation

Recent Posts

Categories

Archives

Managment