---
title: "JustMock and Moles – A short overview for TDD alpha geeks"
url: "https://osherove.com/blog/2010/5/25/justmock-and-moles-a-short-overview-for-tdd-alpha-geeks.md"
canonical: "https://osherove.com/blog/2010/5/25/justmock-and-moles-a-short-overview-for-tdd-alpha-geeks.html"
published: "2010-05-25T12:10:57"
updated: "2010-05-25T12:10:57"
tags: [".NET", ".Net Original", "Agile"]
author: "Roy Osherove"
description: "People have been lurking near my house, asking me to write something about Moles and JustMock, so I’ll try to be as objective as possible, taking in the fact that I work at Typemock. If I were NOT working at Typemock…"
usage: "Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page)."
license: "https://creativecommons.org/licenses/by/4.0/"
---

# JustMock and Moles – A short overview for TDD alpha geeks

By Roy Osherove May 25, 2010 In [.NET](https://osherove.com/blog/category/net), [.Net Original](https://osherove.com/blog/category/net-original), [Agile](https://osherove.com/blog/category/agile)

**Historical article** · Originally published May 25, 2010; technical details may be outdated.

People have been lurking near my house, asking me to write something about Moles and JustMock, so I’ll try to be as objective as possible, taking in the fact that I work at Typemock.

If I were NOT working at [Typemock](http://site.typemock.com/) I’d write:

**JustMock**

**[JustMock](http://www.telerik.com/products/mocking.aspx)** tries to be Typemock at so many levels it’s not even funny. Technically they work the same and the API almost looks like it’s a search and replace work based on the Isolator API (awesome compliment!), but JustMock still has too many growing pains and bugs to be usable. Also, JustMock is missing alot of the legacy abilities such as Non public faking, faking all types and various other things that are really needed in real legacy code. Biggest thing (in terms of isolation integration) is that it does not integrate with other profilers such as coverage, NCover etc.)

Justmock claims to fake anything in MSCorLib, but I did not find this to be the case, except for several specific types. The documentation on how to fake things other than statics shows a very unusual and awkward API to achieve this, which did not work at all for me.

When JustMock comes out of beta, I feel that it should cost about half as Isolator costs, as it currently provides about half the abilities.

**Moles**

**[Moles](http://research.microsoft.com/en-us/projects/pex/)** is an addon of Pex and was originally only intended to work within the Pex environment. It started as a research project and now it’s a power-tool for VS (so it’s a separate install) Now it’s it’s own little stubbing framework. It’s not really an Isolation framework in the classic sense, because it does not provide any kind of API built in to verify object interactions. You have to use manual flags all on your own to do that. It generates two types of classes per assembly: Manual Stubs(just like you’d hand code them) and _Mole_ classes. Each Mole class is a special API to change and break the behavior that the corresponding type. so MDateTime is how you change behavior for DateTime.

In that sense the API is al over the place, and it can become highly unreadable and unmentionable over time in your test. Also, the Moles API isn’t really designed to deal with real Legacy code. It only deals with _public_ types and methods. anything _internal_ or _private_ is ignored and you can’t change its behavior. You also can’t control static constructors. That takes about 95% of legacy scenarios out of the picture if that’s what you’re trying to use it for.

Personally, I found it hard to get used to the idea of two parallel APIs for different abilities, and when to choose which. and I _know this stuff_. I would expect more usability from the API to make it more widely used.

I don’t think that Moles in planning to go that route. Publishing it as an Isolation framework is really an afterthought of a tool that was design with a specific task in mind, and generic Isolation isn’t it. it’s only hope is DEQ – a simple code example that shows a simple Isolation API built on the Moles generic engine.

Moles can and should be used for very simple cases of detouring functionality such a simple static methods or interfaces and virtual functions (like rhinomock and MOQ do).

**Oh, Wait.**

Ah, good thing I work at Typemock. I won’t write all that. I’ll just write:

JustMock and Moles are great tools that enlarge the market space for isolation related technologies, and they prove that the idea of productivity and unit testing can go hand in hand and get people hooked. I look forward to compete with them at this growing market.

## Lessons on this topic

- [Working with Typemock Isolator](https://courses.osherove.com/courses/tdd-in-net-in-hebrew/working-with-typemock-isolator/) · TDD in .NET in Hebrew
- [Isolation Frameworks](https://courses.osherove.com/courses/the-art-of-unit-testing-and-tdd-master-class-in-net/isolation-frameworks/) · The Art of Unit Testing & TDD Master Class in .NET
- [Code Excavations and Domain Specific Test Frameworks](https://courses.osherove.com/courses/the-art-of-unit-testing-and-tdd-master-class-in-net/code-excavations-and-domain-specific-test-frameworks/) · The Art of Unit Testing & TDD Master Class in .NET
- [Testing Legacy Code with Typemock Isolator Deep Dive](https://courses.osherove.com/courses/the-art-of-unit-testing-and-tdd-master-class-in-net/testing-legacy-code-with-typemock-isolator-deep-dive/) · The Art of Unit Testing & TDD Master Class in .NET
- [Isolation Frameworks](https://courses.osherove.com/courses/tdd-in-net-in-hebrew/isolation-frameworks/) · TDD in .NET in Hebrew

## More in .NET

[All posts in .NET](https://osherove.com/blog/category/net)

- Jun 1, 2010

    ### [Video: Continuous Integration with and without team system (Teched 2008)](https://osherove.com/blog/2010/6/1/video-continuous-integration-with-and-without-team-system-te.html)

- May 31, 2010

    ### [Running TeamCity from Amazon EC2 - Cloud based scalable build and continuous Integration](https://osherove.com/blog/2010/5/31/running-teamcity-from-amazon-ec2-cloud-based-scalable-build.html)

- May 25, 2010

    ### [TechEd Israel 2010 may only accept speakers from sponsors](https://osherove.com/blog/2010/5/25/teched-israel-2010-may-only-accept-speakers-from-sponsors.html)

- Apr 9, 2010

    ### [Finding the location of vsixInstaller.exe programmatically](https://osherove.com/blog/2010/4/9/finding-the-location-of-vsixinstallerexe-programmatically.html)


---

## About the author

**Roy Osherove**: Senior Solutions Architect at AWS working on AI for production and AI-driven development; author of The Art of Unit Testing and Elastic Leadership, with about 20 years of consulting and training on unit testing, TDD, team leadership and continuous delivery.

### Sites

- [RobotPaper](https://robotpaper.ai/): This blog: AI patterns and anti-patterns, AI and coding agents, and engineering leadership.
- [osherove.com](https://osherove.com): Roy's personal site. Author of The Art of Unit Testing and Elastic Leadership; consulting and training on unit testing, TDD, team leadership and continuous delivery, plus about 20 years of blog posts.
- [The Art of Unit Testing](https://www.artofunittesting.com): The Art of Unit Testing, 3rd Edition (Manning): readable, maintainable, trustworthy unit tests, plus TDD workshops in C#, JavaScript, Java and Kotlin.
- [5whys.com](https://www.5whys.com): Roy's writing on software team leadership: self-organizing teams, surviving chaos, learning mode and the Elastic Leadership model.
- [Pipeline Driven](https://pipelinedriven.org): Continuous delivery and DevOps practices: build patterns, pipeline-friendly testing, DevOps metrics and enterprise DevOps.
- [Elastic Leadership](https://www.elasticleadership.com): Elastic Leadership, Roy's framework for software team leaders (survival, learning and self-organizing modes).

### Social

- X: https://x.com/royosherove
- LinkedIn: https://www.linkedin.com/in/osherove/

### Contact

- Contact form: https://forms.gle/jQSx5KoXvrVA1JCK7

### License

Licensed under CC BY 4.0 — reuse, quote and adapt with attribution (Roy Osherove, link to the original page). License: https://creativecommons.org/licenses/by/4.0/
