When you run against the exe, you should get a warning similar to this that gives you some hints:
Warning: Unit tests for Windows Store and Windows Phone apps cannot be
run outside appcontainer. Create an app package and run tests in
appcontainer mode.
http://go.microsoft.com/fwlink/?LinkId=254169
In order to use the universal test project, you need to create an app bundle and then run the tests against that. To create the bundle, right click on your project and select Store=>Create App Packages
.
You will create a local app package, so you can select No
for the prompt to upload to the windows store.
Next you will be prompted to fill out the output location, version, ...
On this screen, make sure you select Never
for the Generate app bundle
option.
After clicking create, open the command line to the location where the app bundles were created. You will also have to install the certificate. You can do this from the command line using certutil
:
certutil -addstore "Root" .\UnitTestProjectName_1.0.0.0_x86_Debug.cer
Finally, now you can run your tests using the vstest.console.exe
command line against the app package:
vstest.console.exe .\UnitTestProjectName_1.0.0.0_x86_Debug.appx /InIsolation
This blog post from Microsoft has more information and some other troubleshooting tips. Even though the blog post is marked for the beta of VS11, it seems that most of it still applies.