Missing Silverlight Unit Tests in VS2012

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.

 

Advertisements

Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:

WordPress.com-Logo

Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )

Twitter-Bild

Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )

Facebook-Foto

Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s

%d Bloggern gefällt das: