none
Coded UI

    Question

  • I'm working with Coded UI on Windows 10 Mobile and would like to be able to send keypress events (e.g. Letters or Numbers) to various XAML controls during execution of the tests. I'm wondering if this is possible? Or is coming in a future update to Coded UI?

    Thursday, April 28, 2016 3:01 PM

Answers

  • Done: https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/13731465-vs2015-to-allow-windows-phone-coded-ui-tests-to-ge
    Wednesday, May 4, 2016 3:27 PM

All replies

  • Hi Mr Ant,

    Move to Test Tools in Visual Studio 2010 and 2012 forum for a better support, thanks for your understanding :)

    Best Regards,

    Xavier Eoro


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 29, 2016 8:34 AM
  • Hi Mr Ant,

    >>I'm wondering if this is possible?

    Yes, as far as I know, it is supported now. You can use keyboard.sendkey function or the below code to achieve it:

    For example:

    HtmlEdit uIToEdit = UIMap.UISomethingWindow.UISomethingDocument.UIToEdit;
    
    uIToEdit.Text = "text";

    In addition, don't forget to choose the right template of Code UI test for UWP application.

    Q: How do I create coded UI tests for Universal Windows Platform (UWP) apps?

    A: Depending on the platform where you're testing your UWP app, create coded UI test project in one of these ways:

    • A UWP app running on local machine will run as a Store app. To test this, you must use the Coded UI Test Project (Windows) template. To find this template when you create a new project, go to the Windows, Universal node. Or go to the Windows, Windows 8, Windows node.

    • A UWP app running on mobile device or emulator will run as a Phone app. To test this, you must use the Coded UI Test Project (Windows Phone) template. To find this template when you create a new project, go to the Windows, Universal node. Or go to the Windows, Windows 8, Windows Phone node.

    For the detailed information, please refer to the following document about Test Windows Store 8.1 Apps with Coded UI Tests.

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

    Blogs:

    http://blogs.msdn.com/b/visualstudioalm/archive/2013/08/11/launching-a-windows-store-application-using-coded-ui-test-for-windows-store.aspx

    http://blogs.msdn.com/b/microsoft_press/archive/2013/10/24/from-the-mvps-getting-started-with-coded-ui-testing-for-your-windows-8-1-store-apps.aspx

    Best Regards,

    Lake Xiao


    Monday, May 2, 2016 2:15 AM
    Moderator
  • Hi Lake Xiao,

    Thanks for your reply.

    >> You can use keyboard.sendkey function

    I have tried using the Coded UI Test Project (Windows Phone) template, but the keyboard does not appear to be available by default.  Could you advise me how to include the keyboard in my Windows Phone Coded UI test (as opposed to setting the text in the control)?

    Also, I see there is a Coded UI Test Project (Universal Windows - Phone) template.  I tried that as well and got the same result.  Could I confirm what this template is for?

    Best Regards,

    Mr. Ant 

    Tuesday, May 3, 2016 3:40 PM
  • Hi Mr. Ant,

    Sorry for misleading you.

    keyboard.sendkey function only available for Code UI test(Windows).

    And for Coded UI Test Project (Windows Phone), keyboard.sendkey function is not available.

    The only way I can think is to use Code UI Test Builder to capture the textbox and use the search property to find the control then use Textbox.text ="Text" to assign the value to the textbox.

    >>Could I confirm what this template is for?

    Since you were working with Coded UI on Windows 10 Mobile. You need to use this template : Code UI test Project(Windows Phone)

    Best Regards,

    Lake  Xiao

    Wednesday, May 4, 2016 1:17 AM
    Moderator
  • Hi Lake Xiao,

    >> And for Coded UI Test Project (Windows Phone), keyboard.sendkey function is not available.

    Thanks for the clarification on that.  I was wondering why that is? And also, is there any plan to introduce functionality to generate key press events (in general and/or on specific XAML controls) for Coded UI(Windows Phone) in the forseeable future?

    Best Regards,

    Mr. Ant

    Wednesday, May 4, 2016 8:26 AM
  • Hi Mr. Ant,

    Thanks for your quick response.

    >>is there any plan to introduce functionality to generate key press events (in general and/or on specific XAML controls) for Coded UI(Windows Phone) in the forseeable future?

    I suggest you could submit a feature request for this to the Visual Studio Development team.

    The Visual Studio product team is listening to user voice there. You can send your idea there so the others can vote it. Also I will vote it.

    Best Regards,

    Lake Xiao


    • Edited by lake XiaoModerator Wednesday, May 4, 2016 8:42 AM
    • Proposed as answer by Mr Ant Wednesday, May 4, 2016 3:27 PM
    Wednesday, May 4, 2016 8:33 AM
    Moderator
  • Done: https://visualstudio.uservoice.com/forums/121579-visual-studio-2015/suggestions/13731465-vs2015-to-allow-windows-phone-coded-ui-tests-to-ge
    Wednesday, May 4, 2016 3:27 PM