Coded UI test for Windows Phone 8.1 without emulator - c#

I'm trying to create my first coded ui test for windows phone 8.1, but I can't install emulator on my pc because of my processor(does not support hyper V). So my question is: Can I create coded ui test and run it on my Windows phone, or i have to install emulator for this kind of test?
Thanks :)

According to MSDN testing directly on device should be supported:
Q: Can tests be executed on the emulator only, or can I also use a physical device?
A: Either option is supported. The target for test execution is selected by changing the emulator type or selecting device in the device toolbar. If Device is selected, a Phone Blue device needs to be connected to one of the machine’s USB ports.
However creating tests without the emulator is not possible:
Q: Do I have to deploy the Windows Phone app in the emulator in order to map UI controls?
A: Yes, the coded UI test builder requires that an emulator be running and the app be deployed to it. Otherwise, it will throw an error message saying that no running emulator could be found.
see Test Windows Phone 8.1 Apps with Coded UI Tests on MSDN

Related

C# Universal Windows Platform Open Command Prompt [duplicate]

I'm working on creating custom Cortana commands. The commands are registered and executed using a Universal Windows Platform Application. (GitHub)
For instance, I've registered the following command
<Command Name="ShutDown">
<ListenFor>Shut down</ListenFor>
<Navigate/>
</Command>
To run this function in a UWP application
static async void ShutDown()
{
var dialog = new MessageDialog("This is where I would shut the computer down.");
await dialog.ShowAsync();
//System.Diagnostics.Process.Start("Shutdown", "-s -t 10");
}
But after setting this up I learned System.Diagnostics.Process isn't supported in UWP.
The custom commands I want to run involve some sort of execution such as launching external programs, running other scripts, or opening websites.
It makes sense that UWP doesn't support them given that it's universal and an XBox or a phone might not be able to do these, but I was hoping there was some alternative or hacky way to accomplish this on a Windows 10 PC.
Is there a way for me to execute Process commands or something else with similar functionality in a UWP application? It seems like even though I can get Cortana to execute my C# code, UWP doesn't support much that would be useful in this situation.
Thanks in advance.
There are - limited - ways to achieve similar behavior.
You could use LaunchUri to trigger other apps which registered for a certain URI-Scheme. This should work for your webbrowser scenario. More details here:
https://msdn.microsoft.com/en-us/library/windows/apps/windows.system.launcher.launchuriasync.aspx
You could trigger another app and get results back from it using LaunchForResults. The called app has to support this. More details here:
https://msdn.microsoft.com/en-us/library/windows/apps/mt269386.aspx
You could trigger App Services provided by another app. The called app has to support this. The app service will be executed in background. ( I think this is pretty cool.) More details here:http://blogs.msdn.com/b/mvpawardprogram/archive/2015/06/11/writing-windows-10-app-services-in-javascript.aspx
This is a little hacky: I'm not sure if this still works but it did work for Windows 8.1: You could create a so called "Brokered Component". This allows you to trigger everything from you app on you machine, but you won't be able to publish a brokered component into the store. This also allowed Process.Start() on Windows 8.1. It only worked for sideloaded apps. I'm not sure if it still works on Windows 10.
More info here: https://msdn.microsoft.com/en-us/library/windows/apps/dn630195.aspx
Summary:
Starting another app is pretty easy as long as the target app registered as app service or registered a protocol handler (Uri scheme).
Starting scripts or other *.exe is impossible if option 4 doesn't work any longer.
With the Windows 10 Anniversary Update (1607) there is an option to enable this scenario on PC. With this API in the Desktop Extension SDK you can launch a fulltrust process that runs at the full user privileges:
https://learn.microsoft.com/en-us/uwp/api/Windows.ApplicationModel.FullTrustProcessLauncher
This way you can light it up on the platforms where it is supported, i.e. PCs running 1607 or above. And your app will still be universal:
if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
{
await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
}

Can windows phone store apps run in tablet?

I am developing new windows phone 8.1
[RT] application working fine , but now my client want to give support to tablet also . Does my application work in tablet or I have to create a universal project ?
Please help me out for this .
Windows Phone 7.x or 8.x apps do not run on Windows 8/8.1/10 "out of the box" - you need to either have a universal app, or share your code (for example as a portable class library) to allow it to also run on the desktop variant of the OS.
If you want your app to run on over vendors tablets (such as Android or iOS) there are solutions that allow some code sharing, but again, you're looking at supporting another codebase to achieve this.

Embed Android emulator in .NET application

I am developing a survey designer application in .NET C# which exports the surveys to a file which is sent to android devices. The android device will parse the survey file and show it in the survey mobile app.
Now, I want the user to be able to preview in the .NET application, so they can have an idea of how the survey will look in the android device by displaying the application in an android emulator. Furthermore, I want the emulator to be shown inside a windows form or panel.
My question is: is it possible to show the android emulator inside a winform application and is it possible to communicate with it? In other words, is there any APIs or extensions for Android Emulator in .NET framework?
I have searched the internet for the topic but most results talk about communicating with the emulator via TCP port and launching the application by creating a new process in the .NET app.
It is important to me to be able to display the emulator inside my application since I do not want to deploy multiple applications to my clients.
You can access a Hyper-V instance programmatically using its WMI provider. The Hyper-V instance can run without visible window to the user, and you can send mouse clicks & keyboard input, then take a screenshot.
But, it seems to be infinitely easier and lighter to just replicate the layout logic from the Android app in your C# app. If you went with the Android Emulator route, you're hosting a minimum 512 MB process and all the CPU & GPU usage involved.

Emulate a specific WP device?

I'm creating an app for Windows Phone 8 that spits out a 1-10 score rating your phone's performance (Like the Windows Experience Index) but for windows phone. The app is basically done, but due to how this app works differently from device to device, I would like to emulate multiple devices in the WP emulator. I own a HTC 8X, and I know my app works fine using that, but how can I emulate another device, such as a lumia 920, using the Windows Phone emulator?
You can't emulate a specific device in the emulator. As a workaround, you can use the Remote Device Access provided by Nokia. It will allow you to test the app on a large panel of Nokia phones. Unfortunately, I'm not aware of similar test platforms from other constructors.
In the emulator you can test only diferents resolutions and size of rams, i think it would be two of the things you should "scan" in your app so it can help you to test your app
You can test for different resolution and size by this way
But when you need to test mobile like lumia 920 which runs in WP8 os. You need to have WP8 SDk installed in VS2012.

Can I override the emulator and directly debug the app on my Windows Phone 8?

I have my laptop that has a processor without Virtualization and Second Level Address Translation capabilities, that are required for running the new Windows Phone 8 SDK.
I can however use the Windows Phone 8 sdk, but for testing my apps I will use a windows phone 8 device.
Is it possible to not start the emulator and directly debug the app on my WP8 device?
In Visual Studio, on the drop down on the debug button (green play button) select "Device".
If the debug button is not visible, right click in the area with the toolbar(s)/menu bar and check "Standard".
Here's an article that talks about debugging windows phone apps on physical devices (at the bottom).

Categories