Why TypeMock?

Aug 5, 2008 at 12:14 PM
I downloaded guidance package and opened solution in VS 2008. In source code for TrainingManager.Tests i see that TypeMock is used for mocking objects. Which version of TypeMock is used? Is it free or some of paid versions? I'd recommend usage of free opensource mock framework, such as RhinoMock or Moq, if they can fit requested features for mocking.
Aug 6, 2008 at 1:22 AM
Unfortunately TypeMock is not free and there is a license cost. In our review of the other mocking frameworks such as RhinoMock and Moq, we found that they could not mock classes that are sealed and/or does not have public constructors. SharePoint's API consists heavily of sealed classes and classes with internal constructors, and TypeMock is the only mocking framework that allows to us to mock these classes. We are considering other options for our unit tests such a custom facade for our next release.
Aug 6, 2008 at 1:59 AM
so, community release of type mock (free, as stated on typemock site) cannot be used instead :(
I presumed that mocking of sealed classes is the reason for such choice.
Aug 6, 2008 at 1:04 PM
[charlescho] We are considering other options for our unit tests such a custom facade for our next release.

Would be appreciated - I've budgeted to upgrade my MSDN subscription after the MOSS 2007 trail expires (an additional $1,000+) dollars; my sole reason for doing so is so that I can learn MOSS 2007 development to keep a competitive edge.   I'm just a little guy that doesn't have deep pockets; it will be guys like me filling the need as contractors and employees for the large corporations.   A few years ago I wouldn't have been able to afford this and the SharePoint community would have been minus one SharePoint developer and contributor ;)

FYI,   $349.00 for TypeMock (http://www.typemock.com/Buy.php) is not in the budget; perhaps you can cut a deal with them to have a single developer licence for under $100.00?   The only ROI for owning it will be that you are using it (I'd rather spend the money on books though)....
Aug 6, 2008 at 2:02 PM
it seems that even community release (free) can mock any .net class:With Typemock Isolator you can mock all types, including sealed and internal classes.
http://www.typemock.com/Features.html
I haven't tried this yet.



Aug 7, 2008 at 1:44 AM
Bill, we are aware that people are unable or unwilling to purchase TypeMock for unit testing purpose. For that reason we are considering building our own custom facade for a future release. We are also promoting the use of good design patterns and abstraction of SharePoint API so that the number of places where SharePoint calls are made is minimal.
Aug 7, 2008 at 2:32 AM
[charlescho] We are also promoting the use of good design patterns and abstraction of SharePoint API so that the number of places where SharePoint calls are made is minimal.

Great news!  Reviewing the WSS features and capabilities is somewhat overwhelming;  the company I am currently contracting for will be implementing a MOSS 2007 server later this year (approximately October) and I need to bring the team up to speed before it is deployed.  In an effort to hit the ground running (getting everyones feet wet) I was going to start with Web Services since it will be a while before we all have our systems upgraded to support Virtual PC to setup our Windows Server development environments (at which time your guidance will be deeply needed/appreciated).

Surprisingly, Web Services are not a heavily documented area in the books that I've previewed... What saved the day was the http://www.MSSharePointDeveloper.com web services webcast.  Andrew Connell, noted that "lists" will be our primary concern and he makes it all look to easy (very impressive), unfortunately I couldn't make out the code (screen resolution to small); I'm going to contact him to see if I can't get my hands on it.   My thought was to create a facade that will emulate the SharePoint API to minimize the teams learning curve - I look forward to getting everything installed on my home development server (recently setup for the purpose of SharePoint development).

Appreciate you guys (your going to make me look good :)


Aug 8, 2008 at 2:24 AM
Edited Aug 8, 2008 at 2:26 AM
@panjkov, thanks for pointing out the "free community release  (differences are HERE).   I downloaded it, disabled the evaluation license and was pleasantly surprised to find all test pass!  The current solution doesn't appear to have any dependencies on professional/enterprise features.  

I am not well versed on Mock frameworks (only dinked with NMock and RhinoMock), at least not enough to determine the significance of the lacking features but I do know that the lack of MSBuild support would nix any opportunity to experiment with auto test/build/notification; a high priority and requirement for my current contract.   I'm thinking my time would be better spent learning RhinoMock, which I like better than NMock because it is strongly typed...   Riding on the assumption that future mocks will be done by the SharePoint team...
 
@Charlescho, the System Requirements suggest that "to run the unit test you must have either Team System or one of the Team editions".  I'm running Visual Studio 2008 Professional and am able to run the test???   When I first loaded the solution the option to run test were grayed out, I added a new Test Project, the "run test" features were enabled and as I was copying the test into my new project I realized all of the test were now enabled - I ran them and only two test failed because TypeMock was not enabled (I was in VS when I installed it).  I exited VS2008 and when I reentered TypeMock was enabled and all test passed.
Aug 8, 2008 at 5:33 AM
@billkrat glad I could help.
regarding testing support, you should be able to test with Professional and upper Editions of VS 2008, but in VS 2005 only Team Editions and Suite have MSTest support.
Aug 11, 2008 at 5:54 PM
We will look into the unit testing requirements with using Visual Studio 2008. We can update our requirements if the VSTS Test Edition is not required to run unit tests. Also according to TypeMock the free community release edition doesn't support Natural Mocks, which we are using in our updated unit tests. RhinoMocks is a great mocking framkework, but most of the SharePoint classes can't be mocked using RhinoMocks.
Aug 12, 2008 at 12:47 AM
Edited Aug 12, 2008 at 12:47 AM
@Charlescho:  Avi Kaye (avik@typemock.com), Relationship Manager for TypeMock, noted the following:

"A personal license – meaning a license for a single developer, such as yourself – costs $199, and includes one year of maintenance (upgrades and support). A commercial license – for companies – costs $449 like today, with an extra $99 for the yearly maintenance. We've also decided to release a free, fully functional Isolator for developers who are working on Open Source projects."   

The above email was followed up with an email indicating that they will be launching it next Sunday, the 17th of August.   I suggested they post the info on this message thread when it is launched.

Not sure how this would affect your decision to use TypeMock for the SharePoint guidance but it does open it up to developers like myself who do open source development .  The companies I contract for usually have no problems purchasing software needed to meet requirements so the ROI is there for me now (to learn it).

Aug 20, 2008 at 12:21 PM
@Charlescho and all -

As Bill said, we've just released the latest Typemock Isolator version (5.0), and changed a few things around with the license system. One - we've got a free version for Open Source and two, a license for a single developer is $199 (for companies, the price remains the same). Just to be clear - there is no difference between the functionality of the various licenses. The Open Source setup and the Commercial setup have the same set of features.

If anyone wants to take a look, go here and get the Typemock Isolator you want.

And if anyone has any questions, you can contact me at avik at typemock dot com.


Thanks to Bill, by the way, for pointing me in the direction of this thread.