Missing Silverlight Unit Tests in VS2012

31. Juli 2013

When you are missing the Silverlight unit test project templates in Visual Studio 2012 then you should check this link: http://social.msdn.microsoft.com/Forums/silverlight/en-US/180283df-6cac-45fd-bdce-ff3aec31cb7c/unable-to-create-a-silverlight-unit-test-project-on-vs2012

The problem is that the Silverlight Toolkit will install the template files to the first Visual Studio folder found – or even the default folder in case you installed your VS to a different location. So when you have VS2010 and VS2012 installed on your computer this may be the reason why you will not find the templates in VS2012.

To fix this simply lookup the ZIP files in the VS2010 folder (eg C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\VisualBasic\Silverlight\1033 and C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\VisualBasic\Silverlight\1033) and copy the Silverlight Test zips to the equivalent VS2012 folder.

Finally you will need to start „devenv.exe /installvstemplates“ manually to apply the new templates.

To create or use a new test project you will currently also need the Silverlight Unit Test Adapter – this will enable VS2012 to make the project visible as test in the testbrowser.

If this plugin does not fix the error message when creating a new test project you may need to edit the MyTemplate.vstemplate file inside the project templates ZIP:

Just edit the following line in the „Wizzard“-section to raise the version:
<Assembly>Microsoft.VisualStudio.Silverlight, Version=11.0.0.0, Culture=Neutral, PublicKeyToken=b03f5f7f11d50a3a</Assembly>

I had to go through all the steps to get the project working… Hope Microsoft will fix this soon.

EDIT:

There seems that there exists a different approach via NuGet (see in the answer here):

Just install „Install-Package SilverlightToolkit-Testing“ to the Testproject and manually add the „usings/imports“ to your test classes.

Unfortunately it was too late for me when I found this link – any comment approving this way would be great!

EDIT2:

Another problem came up with the „TestDiscoverer“ (test explorer won’t show the new tests). To fix this I had to add the missing DLLs to the GAC via gacutil:

Open the Visual Studio Command prompt as administrator, go to C:\Program Files (x86)\Microsoft SDKs\Silverlight\v5.0\Toolkit\dec11\Testing and there use gacutil to add the missing DLLs Microsoft.Silverlight.Testing.dll and Microsoft.VisualStudio.QualityTools.UnitTesting.Silverlight.dll

Still I’m struggeling to get my tests working – but finally they’re executed… Maybe my solution will come with a new post soon.

 

Werbeanzeigen

ReSharper 6.0 – First Impressions

16. Dezember 2011

About a week ago I’ve been allowed to use the companies credit card to purchase an update of ReSharper to version 6.0. ReSharper is a really nice plug-in for Microsoft Visual Studio enhancing it with several really useful functions (eg. „Find Usage“, a whole pallette of refactoring tools and code-style-checks).

The new version offers better support for JavaScript and HTML5 and many other things which I’ve been not able to test yet.

But nevertheless I want to share my first experiences:
One of the very fist things I recognized was the visual alert that I’m not following the coding-conventions – especially the naming of variables and functions. With one of my colleagues I discussed the pro’s and cons about this special convention – but finally to say that I think this is a great feature as you start writing code which follows at least one 😉

Also improved are the automatic correction options: Now you’re presented to mostly all „wrong“ parts of code some options to fix it or improve it. Something I do not want to miss anymore…

But with all these „wow“s and „yeah“s there is also one major „d’oh“: The speed of my IDE went down the basement… At several moments I’m able to type words faster than they appear on the screen – not because I’m a hell of a writer but the IDE reacts many times slower than without the plugin. Hopefully the guys from JetBrain will fix this soon.

Stay tuned in case I write a longer review after working more and more with ReSharper.

Happy Shopping!!!