locked
How can I assert an menu item in navigation RRS feed

  • Question

  •  

    Please suggest me how can i assert sub item in navigation. In that condition when I hovering on navigation, Popup appears and then I want select an item to open their respective form but my test case fails. 



    • Edited by Hrishabh Kushwah Thursday, January 21, 2016 2:07 PM
    • Moved by CoolDadTx Thursday, January 21, 2016 3:40 PM Testing related
    Thursday, January 21, 2016 12:25 PM

Answers

  • Hi Hrishabh Kushwah,

    Could you please share us a UI of you control?

    First I suggest you could use drag the crosshair over(Ctrl+I) of the sub item control using code UI test builder and check whether it could locate the control.

    1. If we can capture the sub item control then we could use the code UI test builder to record the test then playback it.

    2. If it can’t be located. I think the sub item in navigation is not support by default in code UI test.

    When you perform your coded UI test, hover over the control. Then press and hold Ctrl, while you press and hold the Shift and R keys on your keyboard. Release the keys. A mouse hover event is recorded by the Coded UT Test Builder.

    For the detailed information, you could refer to the “Selecting a hidden control using the keyboard” and “Manually recording mouse hovers” in the following document:

    https://msdn.microsoft.com/en-us/library/dd286726.aspx#VerifyingCodeUsingCUITCreate

    In this case. I think you could try to use mouse click event. Move over the navigation, move over the sub item in navigation and perform mouse click action.

    For example:

    Mouse.Hover(xxx, new Point(1, 1));

    // Reset flag to ensure that play back stops if there is an error.

    Playback.PlaybackSettings.ContinueOnError = false;

    // Click sub item in navigation

    Mouse.Click(xxx, new Point(42, 17));

    Please also refer to the following document about Hand-coding a Coded UI Test.

    http://blogs.msdn.com/b/mathew_aniyan/archive/2009/02/12/hand-coding-a-coded-ui-test.aspx

    Best Regards,

    Lake Xiao

    • Proposed as answer by lake Xiao Monday, January 25, 2016 1:39 AM
    • Marked as answer by lake Xiao Monday, February 1, 2016 7:04 AM
    Friday, January 22, 2016 7:58 AM

All replies

  • You are saying page not form, which kind of indicates a Web page.

    http://forums.asp.net/

    Thursday, January 21, 2016 1:11 PM
  • I am saying about form. 
    Thursday, January 21, 2016 2:07 PM
  • Test Name: CodedUITestMethod1
    Test Outcome: Failed
    Result Message:
    Test method TB.CodedUITest1.CodedUITestMethod1 threw exception: 
    Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details: 
    TechnologyName:  'Web'
    ControlType:  'Pane'
    TagName:  'DIV'
    Id:  ''
    Name:  ''
      ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.
    Thursday, January 21, 2016 2:12 PM
  • Test Name: CodedUITestMethod1
    Test Outcome: Failed
    Result Message:
    Test method TB.CodedUITest1.CodedUITestMethod1 threw exception: 
    Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException: The playback failed to find the control with the given search properties. Additional Details: 
    TechnologyName:  'Web'
    ControlType:  'Pane'
    TagName:  'DIV'
    Id:  ''
    Name:  ''
      ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.

    You are talking Web technology. It is a Web page a Web form, which is ASP.NET. This is the C# forum. It is not a unit testing forum or an ASP.NET Web page forum. 

    You should post to the correct forum based on the technology you are using.  

    http://forums.asp.net/

    Thursday, January 21, 2016 2:32 PM
  • Hi Hrishabh Kushwah,

    Could you please share us a UI of you control?

    First I suggest you could use drag the crosshair over(Ctrl+I) of the sub item control using code UI test builder and check whether it could locate the control.

    1. If we can capture the sub item control then we could use the code UI test builder to record the test then playback it.

    2. If it can’t be located. I think the sub item in navigation is not support by default in code UI test.

    When you perform your coded UI test, hover over the control. Then press and hold Ctrl, while you press and hold the Shift and R keys on your keyboard. Release the keys. A mouse hover event is recorded by the Coded UT Test Builder.

    For the detailed information, you could refer to the “Selecting a hidden control using the keyboard” and “Manually recording mouse hovers” in the following document:

    https://msdn.microsoft.com/en-us/library/dd286726.aspx#VerifyingCodeUsingCUITCreate

    In this case. I think you could try to use mouse click event. Move over the navigation, move over the sub item in navigation and perform mouse click action.

    For example:

    Mouse.Hover(xxx, new Point(1, 1));

    // Reset flag to ensure that play back stops if there is an error.

    Playback.PlaybackSettings.ContinueOnError = false;

    // Click sub item in navigation

    Mouse.Click(xxx, new Point(42, 17));

    Please also refer to the following document about Hand-coding a Coded UI Test.

    http://blogs.msdn.com/b/mathew_aniyan/archive/2009/02/12/hand-coding-a-coded-ui-test.aspx

    Best Regards,

    Lake Xiao

    • Proposed as answer by lake Xiao Monday, January 25, 2016 1:39 AM
    • Marked as answer by lake Xiao Monday, February 1, 2016 7:04 AM
    Friday, January 22, 2016 7:58 AM
  • Thanks Lake Xiao
    Friday, January 22, 2016 12:12 PM