11

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?

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928

1 Answers1

8

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>
Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
  • do these runsettings need to be part of the unit test project or do you manually place these along side your appx? – Syed Ali Jun 10 '15 at 12:43