none
CodedUI Windows Phone Project Issues - could not launch app with AutomationId

    Question

  • Hi,

    The app in windows phone is not launched when I try to launch it from Coded UI Windows Phone Project in Visual Studio Enterprise 2015.

    I am using :
     Microsoft Visual Studio Enterprise 2015
     Version 14.0.24720.00 Update 1

     Microsoft .NET Framework
     Version 4.6.01055

    Installed :
     Windows Phone SDK 8.0 - ENU 
     Windows Phone 8.1 Update and Emulators : windowsphone81sdkupdate1.exe

    The app to be tested is deployed into Emulator 8.1 WVGA 4 inch 512MB. The app is running fine in emulator.

    I have created a Coded UI test project as follows:

    File -> New -> Project.
    Templates->Visual C#->Windows->Windows 8-> Windows Phone-> Coded UI Test Project(Windows Phone)

    Used a proper project name.

    In the "Generate Code for Coded UI Test" popup window, select Edit UI Map or add assertions.

    Next, drag and dropped from cross-hair tool to my app to be tested. Then copied the value for the app’s AutomationId and pasted to CodedUItest.cs,

    public void CodedUITestMethod1()
    {
      XamlWindow myAppWindow = XamlWindow.Launch("COPIED_AUTOMATIONID");
      //XamlWindow myAppWindow = XamlWindow.Launch("{5B04B775-356B-4AA0-AAF8-6491FFEA5660}:Default:");
      //XamlWindow myAppWindow = XamlWindow.Launch("{9D98AFDC-D8D5-4E31-88B0-7B67C7F9F904}:App:9d98afdc-d8d5-4e31-88b0-7b67c7f9f904_gr9c0mmk005h2!App"); // success when you create an windows phone app using same VS 2015
    }

    Select the same emulator Emulator 8.1 WVGA 4 inch 512MB
    Now, Build and in test explorer, run tests.
    It fails.
    It fails even if you try to launch default app such Calculator or any other default apps.
    It only succeeds when I create a windows phone app using same VS Enterprise 2015 and then copy & paste the AutomationId of this demo app in Coded UI Test Project.

    Error message:

    Test Name: CodedUITestMethod1
    Test FullName: CodedUITestProjectDemo.CodedUITest1.CodedUITestMethod1
    Test Source: ...\documents\visual studio 2015\Projects\CodedUITestProjectDemo\CodedUITestProjectDemo\CodedUITest1.cs : line 23
    Test Outcome: Failed
    Test Duration: 0:00:00.0755546

    Result StackTrace:
    at Microsoft.VisualStudio.TestTools.UITesting.WindowsStoreApplication.Launch(String tileAutomationId)
       at Microsoft.VisualStudio.TestTools.UITesting.WindowsRuntimeControls.XamlWindow.<>c__DisplayClass4_0.<Launch>b__0()
       at Microsoft.VisualStudio.TestTools.UITesting.CodedUITestMethodInvoker.InvokeMethod[T](Func`1 function, UITestControl control, Boolean 

    firePlaybackErrorEvent, Boolean logAsAction)
       at Microsoft.VisualStudio.TestTools.UITesting.WindowsRuntimeControls.XamlWindow.Launch(String tileAutomationId)
       at CodedUITestProjectDemo.CodedUITest1.CodedUITestMethod1()
    Result Message:
    Test method CodedUITestProjectDemo.CodedUITest1.CodedUITestMethod1 threw exception: 
    Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException: Exception occurred while trying to launch the app. Verify that the app 

    is installed: Value does not fall within the expected range., AutomationId of Tile: '{5B04B775-356B-4AA0-AAF8-6491FFEA5603}:Default:'


    I have verified AutomationId number of times and even the built-in app such as Calculator, Camera, Calendar, etc, in emulator could not be able to launch.

    Thanks,
    Mitul


    • Edited by Mi2l Thursday, February 18, 2016 8:08 AM
    Thursday, February 18, 2016 6:33 AM

Answers

  • Hi Lake,

    I think I have found out the issue.

    The app I am trying is a silver light based windows phone app(it builds into xap binary) and not xaml based app.

    And as far as I know, Coded UI Test does not support silver light based app, I believe.

    Is it the same case with default Calculator, Alarm, Calender app ?

    Anyway, I have wasted a lot of time of yours. I am sorry for that.

    BTW, do you have any idea if there is any tool using which we can do Automated UI Test for silver light based windows phone app?

    Once again, thank you for your valuable time.

    Regards,

    Mitul

    • Marked as answer by Mi2l Friday, March 04, 2016 8:01 AM
    Friday, March 04, 2016 8:00 AM

All replies

  • Hi Mitul,

    Thanks for your post.

    As far as I know, Calculator, Camera, Calendar. They are windows store app. So if you want to capture it. Please use Code UI test Project(Windows).

    And for your issue.Since the Coded UI Test Project templates are only available on Windows 8.1 and Windows 10. To create automation for Universal Windows Platform (UWP) apps, you'll need Windows 10.

    Please check your windows system. Make sure your OS system is windows 8.1 or windows 10.

    >>It only succeeds when I create a windows phone app using same VS Enterprise 2015 and then copy & paste the AutomationId of this demo app in Coded UI Test Project. 

    From your description. Since it succeeds when create a new windows phone app using VS2015. And I think the cause of your issue is probably in your Windows Phone APP. Please check where did the windows phone app create?

    If your windows phone app created in old version of VS like VS2013, and you want to run it in VS2015. I suppose there might be some compatible issues.

    In this case, I suggest you could recreate a new windows phone app in your VS2015. Then follow the steps with the following document to create code ui test. Then I think you could playback it successfully.

    Please take a look at the following document about "Test Windows Phone 8.1 Apps with Coded UI Tests"

    https://msdn.microsoft.com/en-us/library/dn747198.aspx


    Best Regards,


    Lake Xiao

    Friday, February 19, 2016 2:44 AM
    Moderator
  • Hi lake,

    Thank you for quick response.

    My desktop OS system is windows 8.1

    I tried creating Coded UI test Project(Windows) and tried to run default  Calculator, Camera, Calendar apps; still no luck.

    The app that I am trying to test is a Windows Phone 8.0 Project and was created with VS2013. 

    Next thing, I am going to try is install VS Ultimate 2013 and try to test the app.

    Thanks,

    Mitul

    Friday, February 19, 2016 12:24 PM
  • Hi Mitul,

    >>The app that I am trying to test is a Windows Phone 8.0 Project and was created with VS2013

    Since the APP was created in VS2013, please try to test it using VS2013.

    By the way, please use VS2013 to test Calculator as well.

    Best Regards,

    Lake Xiao

    Monday, February 22, 2016 1:40 AM
    Moderator
  • Hi,

    I tried with VS2013 Ultimate Update 5.

    I am still getting the same error:

    Microsoft.VisualStudio.TestTools.UITest.Extension.PlaybackFailureException: Exception occurred while trying to launch the app. Verify that the app is installed: Value does not fall within the expected range., AutomationId of Tile:  

    Also, the default Calculator app is also not launched from the app ID.

    Note: I have used VisualC#->Store Apps->Windows Phone Apps->Coded UI Test Project(Windows Phone) template.

    Regards,

    Mitul

    Monday, February 29, 2016 7:55 AM
  • Hi Mi2l,

    Make your emulator is running.

    And I suppose whether there exist two emulators in your side. To avoid this problem. Please add the Code UI Test project (Windows phone) and your UWP project into same solution.

    Then make sure the emulator is running then try to capture the AutomationId and try to launch it.

    Please create a new solution follow the steps one by one in the following document then try it again.

    https://msdn.microsoft.com/en-us/library/dn747198(v=vs.120).aspx

    Best Regards,

    Lake Xiao

    Monday, February 29, 2016 9:20 AM
    Moderator
  • Hi Lake,

    I think I have found out the issue.

    The app I am trying is a silver light based windows phone app(it builds into xap binary) and not xaml based app.

    And as far as I know, Coded UI Test does not support silver light based app, I believe.

    Is it the same case with default Calculator, Alarm, Calender app ?

    Anyway, I have wasted a lot of time of yours. I am sorry for that.

    BTW, do you have any idea if there is any tool using which we can do Automated UI Test for silver light based windows phone app?

    Once again, thank you for your valuable time.

    Regards,

    Mitul

    • Marked as answer by Mi2l Friday, March 04, 2016 8:01 AM
    Friday, March 04, 2016 8:00 AM
  • Hi,

    Is there any tool for UI Automation Testing for a Silverlight based Windows Phone app?

    Regards,

    Mitul

    Tuesday, March 08, 2016 1:24 PM