New SharePoint Developer Features in VS2010 SP1 – Unit Testing and IntelliTrace (Saaid Khan)


We recently released Visual Studio 2010 SP1 Beta and SharePoint developers will be excited to know there are some great features that are now available to them. As part of VS 2010 SP1 SharePoint developers can now take advantage of IntelliTrace as well as create unit tests that use SharePoint API’s.

With 64-bit support now enabled in IntelliTrace, you can use IntelliTrace in your SharePoint farm solutions. You can set a break-point in your code or break execution and then view the IntelliTrace data. You can also collect IntelliTrace data and save the .itrace log file for viewing at a later time. Check out Justin Marks great article on IntelliTrace in VS2010.

For those SharePoint developers that create unit tests, you can now create and execute unit tests for your SharePoint 2010 solutions if they use SharePoint API’s. In order to execute these unit tests you first need to deploy your SharePoint solution to your local developer machine. After that, you can execute the unit tests as you would normally.

We’ll have another blog post by the end of the month detailing how you can use IntelliTrace and unit testing in SharePoint farm solutions.

Please install Visual Studio 2010 SP1 Beta, try these new features, and let us know what you think.

-Saaid Khan (MSFT)

Comments (4)

  1. Oleg Slyusarchuk says:

    Thank you,

    Works as expected (however, in a simple scenario).

    channel9.msdn.com/…/Visual-Studio-SP1-and-SharePoint-2010-Unit-Test

    is a great source on details.

    One more comment.

    Test project is having difficulties working with SharePoint project when it (SharePoint package) has been deployed in GAC.

    It gives the following message:

    Test method UnitTests.SpTestTest.GetSiteTitleTest threw exception:

    System.TypeLoadException: Could not load type 'Publishing.Library.SpTest' from assembly 'Publishing, Version=0.9.1203.1, Culture=neutral, PublicKeyToken=e09a6bb7d4a20305'.

    Work-around:

    Retract SharePoint solution, re-build solution projects.

  2. Oleg Slyusarchuk says:

    It looks like that not everything has been fixed in SP1:

    I'm getting the following message when I try to run get code coverage:

    Warning 1/20/2011 2:38:45 PM Diagnostic data adapters are not supported when you run tests that target .Net Framework 3.5. The following diagnostic data adapter is not enabled: Microsoft.VisualStudio.TestTools.CodeCoverage.CoveragePlugIn, Microsoft.VisualStudio.QualityTools.Plugins.CodeCoverage, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

    Essentually, the same is applied to the other diagnostic data adapters like Video Recorder

  3. Tajeshwar says:

    Code coverage not working. Any tips?

  4. Paul Arnold says:

    The Fakes functionality has now been moved into Visual Studio 2012 Ultimate edition.

    What are developers that only have Premium or lower supposed to do now?

    Is there any intention of permitting Fakes in non-ULtimate editions of Visual Studio 2012 for SharePoint projects?