Home > Blogs > Eric Shupps > Posts > Unit Testing SharePoint in a 64-bit Environment
​The SharePoint Cowboy


August 03
Unit Testing SharePoint in a 64-bit Environment

I've recently upgraded all my development environments to pure 64-bit (except, of course, for Visual Studio, which continues to be a 32-bit laggard) to take advantage of the extra memory space available in x64. When working with really large lists and datasets, having less than 1GB for the w3wp process is self-defeating - it's not uncommon to crash the worker process even with paged gridviews. Plus, the performance of SharePoint and SQL Server on 64-bit is head and shoulders above x86, making it easier to work with multiple VM's at once.

That being said, I've been behind the curve in getting all the code in my core presentations converted over to a true MVP pattern with unit tests and the like, so I decided to take some time ahead of the Devlink conference later this month to refactor my high performance code samples. What should have been a relatively simple task soon turned into a man-against-machine bare-knuckles cage match. I really like the MSTest framework in Visual Studio, so I started rewriting all my old NUnit tests to take advantage of the nice IDE integration that Visual Studio Team Test 2008 offers. Within a few minutes I ran head first into an unmovable wall. No matter what I tried, as soon as I tried to run a test against any methods which referenced the SharePoint DLL's I got a "System.IO.FileNotFoundException" error. No matter what I tried, VS simply would not run my tests.

After hours and hours of digging through Process Explorer, chasing down output in the debugger, and generally giving myself a splitting headache, I finally stumbled upon Lars Fastrup's post on issues with vstesthost.exe in a 64-bit environment (Lars, I owe you a drink in November). Seems that the VS team never imagined we'd be running test cases against 64-bit DLL's - here we are in 2009 and vstesthost.exe is still a 32-bit process. Great. So now what?

Well, it seems that there is no way to get VS 2008 to run tests in a 64-bit dev environment so I had to drop back to NUnit. Now, to be fair, NUnit and TestDriven.net are fine frameworks but they lack true IDE integration. I want a GUI inside of VS just like MSTest - I don't want to launch a clunky WinForm app just to view the results of my tests. Plus, NUnit is just s-l-o-w compared to the Visual Studio test framework. Just what I needed - another slow add-in to put an anchor on my testing process.

So if you see me running NUnit for my test fixtures now you know why. We can only hope that the VS folks have seen the light and the VS2010 test framework will be native 64-bit. Anyone want to make a wager on the chances of that happening?

Comments

NUnit IDE Integration

Hi Eric,

I've been using Resharper's Unit Testing Integration for NUnit, MBUnit and even MSTest for some time now. Alternately, you could try the Gallio project with is a universal xUnit test runner framework.

I am currently writing my unit tests (all NUnit) against SharePoint on an x64 vm. So far it has been difficult to adequately isolate tests to small units - is there some hidden approach that will make it easier (I haven't tried TypeMock yet)
System Account on 8/4/2009 8:42 AM

TestDriven.NET is the IDE integration

Quick tip: right-click on the test you want to run and there will be a TestDriven.NET context menu, which allows you to run tests, run tests w/ debugger, etc. Test results appear in the Output window. I believe failed tests also appear in the Errors window along with compilation errors, but I never use this feature.

If desired, you can also map a hotkey (everything's under TestDriven.NET.Something) to run the tests at any time. I like mapping ReRun Test to a key, so that no matter where I am in the codebase, I can hit the key and it will build+run the test I'm interested in.

I don't think TestDriven.NET works with MSTest anymore, so you may have to go back to NUnit to use it.

Also, big TD.NET gotcha: if you have GAC'ed your assemblies, TD.NET will look for assemblies in the GAC first, THEN your local project copy. So make sure you've un-GAC'ed everything, or have GAC'ed your most recent copy, before running tests.

I had a long, ugly troubleshooting session before I figured that out.
System Account on 8/4/2009 11:41 AM

Re: Unit Testing SharePoint in a 64-bit Environment

Guys, Great article and very very interesting blog. That’s one thing I’m really looking forward. Looking forward to reading more from you next week.
http://www.nikeairjordan.cc/
System Account on 8/10/2010 9:16 PM

Zoe

supplied the business in style which has an knowledge in pattern plus class along with continues to realize this utilizing great invention as well as fine artwork. http://www.bothdress.com cheap wedding gowns  Somebody who want to private personal a set your shoes at present can certainly as Gucci Bags very low priced shoes are available   . Pretty high quality is really serviced quite possibly supposed for such items and remedies which can be accessible for invest in pertaining to extra costeffective estimates.Gucci cost lower footwear on top of that  http://www.celldress.org evening dresses  http://www.bothdress.com/wedding-dresses-v-neck-wedding-dresses.html 
 on 3/10/2012 1:45 AM

Spy software

Thank you so much in putting together this post, so much appreciated because it has helped me in my research. Here are some wonderful websites:
Web filter: http://www.aobo-porn-filter.com/
Keylogger: http://www.microkeylogger.com/
Mobile spy: http://www.spy-mobile-phone.com/
 on 3/12/2012 8:48 PM

Ariana

 a conventional toothbrush since with these fine bristle program it really is basically primarily executing a flossing also, which indicates you're going to save capital within the dentist and have a lot higher teeth hygiene inside your every single day life http://www.watcheview.com/rolex-watches.html , http://www.fakesale.org  and that's what all of us want. 1 added function though applying Rotadent toothbrush is normally that we are definitely capable of obtain individuals hard spots like fully in balance which blind spots that are super easy to miss out on. When you are  http://www.fakesale.org/mens-watches.html  http://www.watcheview.com/romain_jerome-watches.html 
 on 3/16/2012 8:44 PM

Mason

 on 3/23/2012 1:46 AM

Jordan

 find a collision repair facility with well qualified and trained technicians who can repair your vehicle and restore it to its original shape and make it looking new.    http://www.somefake.com  There may be times when you may not know what to do when repairs are required for your vehicle as a result of which the auto body repair may get neglected and even put off for a long time resulting in more damages leading to more expenses out of your pocket   . Below are some helpful tips you can follow to get you started with your auto body repair and get your car to look its best http://www.didwatch.com/rolex-replica.html wholesale rolex watches
 on 4/12/2012 3:26 AM

lester

this department. Women's Department Carefree Casuals women's clothing, including dresses and women's accessories, will outfit you for every occasion. Find stylish, women's shirts, women's pants, women's jackets and more in an array of colors and designs   .    Shop Our Selection Of Active Wear, http://rockrealms.net     Casual Apparel & Other Specialty
 on 4/22/2012 11:35 AM

harris

 the tools they have to go out and make a lot of money that produces everybody happy! 5. Company Name   : You wish to form positive you are joining a highly reputable company      . Youll be promoting and adding your name to the current company therefore do your research http://www.day-great.com . Do a Google search, check affiliate marketing forums and see what
 on 4/22/2012 11:39 AM
1 - 10Next

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Comment Date *

Select a date from the calendar.
Enter the current date to prevent automated spambot comments.

Attachments


 
 
 


 

Copyright © 2011 BinaryWave, Inc. All rights reserved.