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):
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?
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.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With