Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to run WP81 unit tests with VSTest.Console.exe

I am trying to run Windows Phone 8.1 unit tests from the command line using the vstest.console.exe. I have created a new Windows Phone 8.1 unit test project in VS 2013 (Update 4):

enter image description here

The unit test is discovered in Visual Studio and I am able to run it successfully:

[TestClass]
public class UnitTest1
{
    [TestMethod]
    public void TestMethod1()
    {
        Assert.IsTrue(true);
    }
}

The next step is to create a new AppPackage from my test project which generated the desired .appx file. Then I tried to run the unit test contained in this file using the following command:

vstest.console.exe /InIsolation /settings:Test.runsettings UnitTestApp1_1.0.0.0_x86_Debug.appx

where Test.runsettings looks like this:

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <MSPhoneTest>
    <TargetDevice>Emulator WVGA</TargetDevice>
  </MSPhoneTest>
</RunSettings>

This command started the emulator but fails with this error:

Error: Installation of package 'D:\work\WP81UnitTestApp\UnitTestApp1\AppPackages\UnitTestApp1_1.0.0.0_x86_Debug_Test\UnitTestApp1_1.0.0.0_x86_Debug.appx' failed with Error: (0xFFFFFFFF) To run unit tests for a Windows Phone app, the app must target Windows Phone 8 or higher..

Any idea what might be wrong?

like image 767
Darin Dimitrov Avatar asked Jun 05 '15 13:06

Darin Dimitrov


People also ask

Does Visual Studio use MSTest or VSTest?

The Visual Studio Tests build runner integrates functionality of the MSTest framework and VSTest console runner. Support for both frameworks enables TeamCity to execute tests and automatically import their test results.


1 Answers

Turns out that I was using a wrong emulator name in my Test.runsettings file. Changing it to this made my tests work:

<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <MSPhoneTest>
    <TargetDevice>Emulator 8.1 WVGA 4 inch 512MB</TargetDevice>
  </MSPhoneTest>
</RunSettings>
like image 116
Darin Dimitrov Avatar answered Sep 21 '22 05:09

Darin Dimitrov