none
VS 2012 Silverlight UnitTest

    Question

  • Hi,

    I am using VS 2012 + SIlverlight 4/5. WHile using VS 2010 i could create Silverlight UnitTests as the tool has an option to create one. Unlike VS 2010, its successor does not have a templete installed. I want to make use of the new Fakes Isolation framework with VS 2012 + Silverlight effectively

    Can someone suggest what do i need to do :( .

    Regards,

    Karthik


    Karthik G Naga

    Friday, November 23, 2012 12:39 PM

All replies

  • Hi Karthik,

    As far as I know that to create Silverlight unit tests in VS2012, you can install Silverlight Unit Test Adapter: http://visualstudiogallery.msdn.microsoft.com/caca1e81-becb-41e4-9110-bc247f3f400b?SRC=Home 

    Thanks.

    Vicky Song [MSFT]
    MSDN Community Support | Feedback to us

    Monday, November 26, 2012 7:47 AM
    Moderator
  • Hi Vicky,

    Thanks a ton for your post. It is very disappointng to note that VS2012 does not have support for Silvelright Test Template.

    Anyways, i will wait for some more time untill MS comes up with a working version of this template sooner.

    On another note, i was using 3rd party Isolation framework to Mock out dependencies in my code. I heard a lot about Fakes & Stubs in VS 2012. I know a little bit about Pex & Moles in VS 2010 but they did not help much, as i was trying to Isolate RIA Services dependency while using LinqToEntitiesDomainService<T>. Can i expect any support from fakes & stubs?

    Also, i tried to use JustMock & TypeMock to Mock "sealed" classes but it need a paid version which i don't think is an option for me at this point, unless i am convinced to buy it.

    Please suggest!!!

    -Karthik


    Karthik G Naga

    Monday, November 26, 2012 9:00 AM
  • Rather than using the outdated Silverlight Tookit templates (which can be installed by manually copying them to the VS2012 dir and running `devenv /installvstemplates` from the VS command prompt), I recommend starting a new Silverlight project and installing the SilverlightToolkit-Testing NuGet package. In your test files, put in usings for Microsoft.Silverlight.Testing and Microsoft.VisualStudio.TestTools.UnitTesting and use regular [TestClass] and [TestMethod] attributes. To run them, you can use the Toolkit test runner by putting `RootVisual = UnitTestSystem.CreateTestPage();` in your App.Application_Startup(), use Silverlight Unit Test Adapter (which currently is at v0.0.1 and doesn't really work), or (the best approach by far) install ReSharper and the AgUnit plugin.

    I'm not sure you'll be able to use Fakes. MS has dumped Silverlight (not that VS ever had great support for it) and it hurts. But it's ok, there's lots of other mocking frameworks and testing strategies.

    Or you can switch to JavaFX and Netbeans :)

    • Proposed as answer by bill-mybiz Monday, December 03, 2012 4:50 AM
    Sunday, December 02, 2012 6:41 PM
  • Thaaaaaank you Alex. I've been searching all day trying to figure out how the right way to add the Silverlight Unit Test framework to VS 2012. This is the only link that I could find that points to that particular package (SilverlightToolkit-Testing). This package does NOT show up if you just click on manage NuGet packages. I had to go to this link: http://nuget.org/packages/SilverlightToolkit-Testing to find it. You are my hero dude. I was seriously contemplating working on the WinRT UI while they work on getting the Silverlight Test Framework going for VS 2012...I couldn't believe it wasn't a bigger part. I mean I know MS is shying away from SL but come on. I can't migrate my SL project to 2012 without unit testing! Anyway, I digress. Thanks again for your post.
    Monday, December 03, 2012 4:50 AM