locked
CodedUI Assertion Issue RRS feed

  • Question

  • I'm trying to verify a runtime-created random string.  Why is this not working?  Here is the Designer code.

                // Verify that the 'InnerText' property of 'New BVT Task YNx' link contains 'YNx'
                StringAssert.Contains(uINewBVTTaskYNxHyperlink.InnerText, this.EIMS_4908_QA_Assertion_TaskCreatedExpectedValues.UINewBVTTaskYNxHyperlinkInnerText, "Task was not created.");
            

    This is my Test code: CreateRandomAllegationTitle() returns a string which is also saved into myTitle.

    			this.UIMap.EIMS_4908_QA_CreateTaskParams.UISubject_iEditText = "New BVT Task " + CreateRandomAllegationTitle();
    			this.UIMap.EIMS_4908_QA_CreateTask();
    			this.UIMap.EIMS_4908_QA_CreateTask_PreVerifyParams.UISearchforrecordsEditText = myTitle;
    			this.UIMap.EIMS_4908_QA_CreateTask_PreVerifyParams.UISearchforrecordsEditText1 = "New BVT Task " + myTitle;
    			this.UIMap.EIMS_4908_QA_CreateTask_PreVerify();
    			this.UIMap.EIMS_4908_QA_Assertion_TaskCreatedExpectedValues.UINewBVTTaskYNxHyperlinkInnerText = myTitle;
    			this.UIMap.EIMS_4908_QA_Assertion_TaskCreated();

    Expected Result:

    New BVT Task Gheft7hd is created.

    A search is done for Gheft7hd

    An assertion looks for (contains) Gheft7hd in the task Title (hyperlink) New BVT Task Gheft7hd

    Errors:

    Test Name: CodedUITestMethodQA_CreateTask
    Test Outcome: Failed
    Result Message: 
    Test method XRM_EIMS_BVT.CodedUITest1.CodedUITestMethodQA_CreateTask 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:  'Hyperlink'
    TagName:  'A'
    Id:  'gridBodyTable_primaryField_{3DC0B434-7416-E411-8A5A-005056912637}_0'
    Name:  ''
    Target:  '_self'
    InnerText:  'New BVT Task Gfh4dg'
     Failed to find any control that matched the value gridBodyTable_primaryField_{3DC0B434-7416-E411-8A5A-005056912637}_0 for the search property Id. ---> System.Runtime.InteropServices.COMException: Error HRESULT E_FAIL has been returned from a call to a COM component.

     

    Monday, July 28, 2014 7:05 PM

All replies

  • Hi Countrysideflair,

    >> Expected Result InnerTex: New BVT Task Gheft7hd is created

         Actual Result InnerText: New BVT Task Gfh4dg

    >> The playback failed to find the control with the given search properties.

    >>Failed to find any control that matched the value gridBodyTable_primaryField_{3DC0B434-7416-E411-8A5A-005056912637}_0 for the search property Id.

    So you mean that you encountered the above error information after you change the InnerText text property value form 'New BVT Task Gfh4dg' to ‘New BVT Task Gheft7hd’ using custom code in coded UI test, am I right?

    Based on the error message, it means that it failed to find your control with the previous search property when you playback your coded UI test.

    Therefore, I suggest you could use the coded UI test Builder to check the real ID property after you changed the Inner Text property,  you could add Assertions on the specific control, and then check the ID property now. You could compare the new search property ID value with previous property ID value if they are same. If not, I’m afraid that you would change it manually in your code if you use it as the search property.

    Best Regards,


    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.


    • Edited by Tina-Shi Tuesday, July 29, 2014 9:18 AM
    Tuesday, July 29, 2014 9:18 AM
  • Okay, lets do this in story form.

    Joe Bloe creates a new task and names it "YgHr6g", then saves it.

    Joe Bloe later wants to search for it, so in the search box he types YgHr6g.  The task shows up in a gridBodyTable.  

    Joe happens to be blind, so he has an app (CodedUI Assertion) that searches the result (Title or Inner Text) to see if the task name he created really is there.

    The task is created with a dynamic title, then the codedUI should be checking if title contains the dynamic string. 

    Does "New BVT Task YgHr6g" contain "YgHr6g"?

    Does "New BVT Task YNx" contain "YNx"?

    Does "New BVT Task R5h2FYg" contain "R5h2FYg"?

    For some reason, it continues to fail even though it is true.

    Tuesday, July 29, 2014 11:20 PM
  • Hi Countrysideflair,

    (1)    You created a new task” YgHr6g” and save it.

    (2)    You typed the YgHr6g in the search box and then show up the YgHr6g in a gridBodyTable.

    >> The task is created with a dynamic title, then the codedUI should be checking if title contains the dynamic string. 

    (3)    You created a new dynamic title “New BVT Task YgHr6g “contain “YgHr6g”.

    Could you please provide me screenshot about after you changed the task’s dynamic title, what is type in the search box and what is show up in gridBodyTable form the UI.

    Do you mean that your task title have been changed from previous (2) step to the (3) step in gridBodyTable?

    Do you mean that you type the YgHr6g in the search box and then would like to the new task (New BVT Task YgHr6g) shows up in a gridBodyTable after you change the task title?

    I would like to make sure these issues, so I hope you can provide us more detail information.

    Best Regards,


    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.


    • Edited by Tina-Shi Friday, August 1, 2014 12:58 AM
    Friday, August 1, 2014 12:58 AM