locked
Coded ui tests - don't understand how to change the code RRS feed

  • Question

  • So I was experiencing an object not found error in the solution set that I have adopted. So I opened the UIMap in the UIMap solution. I removed one of the search properties. Bingo now it can find the object. Then I carefully followed the following steps because I am confused.

    - I deleted the dll and pdb file from the file system. I opened the project that references this dll. A handy little yellow exclamation shows that it cannot find the referenced assembly.

    - I clean and build the UIMap project. Dll is present on the file system where expected. The project that uses the UImap sees it and the yellow exclamation goes away.

    - I run the coded ui test project. I receive the same object not found error:

    Microsoft.VisualStudio.TestTools.UITest.Extension.UITestControlNotFoundException was unhandled by user code
      Message=The playback failed to find the control with the given search properties. Additional Details:
    TechnologyName:  'MSAA'
    ControlType:  'Table'
    Name:  'ultraGrid1'

    The bolded is the item that I removed from the SearchProperties.

    If I put this line

    _structuredNotesMap.UIStructuredNotesEntryWindow.UIOMPUltraGrid1Window.UIUltraGrid1Table.SearchProperties.Remove("Name");

    in the method that refers to the UIMap, the object is found.

    But I don't want to do that. I want two things:

    - To put the right search properties in the UIMap.

    - Understand assemblies and how/where they are build and referenced.

    Can anyone help? Thanks.

    S

    Tuesday, November 26, 2013 2:18 PM

Answers

  • StephanieVT,

    Try this:

    Make sure the change you made is still there in the properties pane for the specified object. Save and close the that window.  Now go ahead and right click the map and 'Edit with Coded UI Test Builder'.

    Without making any changes, click the generate icon and confirm that you want to re-generate even though you "haven't made any changes"...

    Your designer.cs file has to be regenerated for it to know about the changes you made to the UIMap. This is a big gotcha with CUITs and can be a source anguish if you don't do it practically everytime you make a change.

    Hope it helps, 

    Monday, December 2, 2013 3:02 PM
  • It turns out that I WAS misunderstanding the build process. The UI map project's dll was not being populated in the test's build destination because it was not referenced directly in the test project. Kinda dumb on my part, actually. But learning has been achieved.

    • Marked as answer by StephanieVT Friday, December 6, 2013 2:21 PM
    Friday, December 6, 2013 2:21 PM

All replies

  • Hi StephanieVT,

    Thanks for your post!

    According to your description, I think you needn’t modify the code directly.

    You could edit the control properties in the Coded UI Test Editor, for more information, please refer to:

    http://msdn.microsoft.com/en-us/library/gg269459(v=vs.100).aspx

    If you want to modify the code directly, please refer to:

    # Creating, Editing and Maintaining a Coded UI Test

    http://msdn.microsoft.com/en-us/library/ff977233(v=vs.110).aspx

    Thanks

    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.

    • Proposed as answer by griswald_911 Wednesday, November 27, 2013 12:12 PM
    Wednesday, November 27, 2013 7:22 AM
  • I understand the Coded UI Test Editor. I am not trying to edit the UI Map code directly of course. I am editing the properties of the object by highlighting it and right clicking and choosing properties. These properties need to be refined after using the Coded UI Test Builder mechanism generates. So I found the desired object in the UI Map project, right clicked on it and chose locate. The control is not found. I then chose properties. From there I clicked the ellipsis next to the SearchProperties collection. I removed one of the properties. I saved the properties, did locate control again. Voila, c'est ici!

    I build the project. I see rebuild all succeeded with the dll located where the action project is pointing in references. At this line of code:

    _structuredNotesMap.UIStructuredNotesEntryWindow.UIOMPUltraGrid1Window.UIUltraGrid1Table.Find();

    The test is failing with an error message that the object cannot be found. The error reports the name that I removed from the SearchProperties collection above is still being sought.

    So ... this is a Visual Studio build question? What has become of the change that I made to the UIMap?

    Thanks for your help.

    Monday, December 2, 2013 1:49 PM
  • StephanieVT,

    Try this:

    Make sure the change you made is still there in the properties pane for the specified object. Save and close the that window.  Now go ahead and right click the map and 'Edit with Coded UI Test Builder'.

    Without making any changes, click the generate icon and confirm that you want to re-generate even though you "haven't made any changes"...

    Your designer.cs file has to be regenerated for it to know about the changes you made to the UIMap. This is a big gotcha with CUITs and can be a source anguish if you don't do it practically everytime you make a change.

    Hope it helps, 

    Monday, December 2, 2013 3:02 PM
  • Hi StephanieVT,

    I can’t reproduce your scene in VS Ultimate 2012. (The searchproperty will be remove after I remove it in the Edit Search Properties window, we could check the code in the UIMap.Designer.cs)

    Please refer to griswald_911’s reply and check the result.

    If you still have the issue, please provide the details below:

    1. What the version of your VS is?
    2. What’s the application that you do the test? Please provide the screenshot to us.

    Thanks

    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.

    Tuesday, December 3, 2013 2:42 AM
  • It turns out that I WAS misunderstanding the build process. The UI map project's dll was not being populated in the test's build destination because it was not referenced directly in the test project. Kinda dumb on my part, actually. But learning has been achieved.

    • Marked as answer by StephanieVT Friday, December 6, 2013 2:21 PM
    Friday, December 6, 2013 2:21 PM