Mapping ToolStripDropdownMenu in keyword testing
Hi,
We are doing keyword testing and are just getting started with TestComplete. However, we have run into an issue with the .NET item ToolStripDropDownMenu.
We have added it using “Add From Screen” method in the Miscroft Winforms, but that hasn’t solved our issue.
The issue is when we map the dropdowns they have the base class, so we have no way of knowing which ToolStripDropDownMenu we are actually hitting when we run the tests and it has resulted in several tests failing because of TestComplete being unable to identify the relevant dropdowns.
I have added an example on how the mapping looks like base in a small mocked up application(Attached as well if anyone is interested)
Top ToolStripDropDownMenu: Sys.Process("BlandetSlik").WinFormsObject("Form1").WinFormsObject("toolStripContainer1").WinFormsObject("ToolStripPanel", "", 4).WinFormsObject("menuStrip1")
Bottom ToolStripDropDownMenu: Sys.Process("BlandetSlik").WinFormsObject("Form1").WinFormsObject("toolStripContainer1").WinFormsObject("ToolStripPanel", "", 5).WinFormsObject("menuStrip2")
Try to guess which of the actual dropdownMenues have been mapped:
Sys.Process("BlandetSlik").WinFormsObject("ToolStripDropDownMenu", "")
And you guessed wrong, the picture just shows one of the 4 dropdownmenu’s in this little application, the one that as mapped was actually the “Bottom”.
So the question is – how can we ensure that the right toolstripdropdownmenu is hit in our tests everytime?
Kind Regards
Soeren Gormsen
QA Manager
NIS
What you have shown is full name of the object which looks similar except WinFormsObject("ToolStripPanel", "", 4) the number. And I think that number may be random or created dynamically .
To identify two menus separately you have to use unique property of these objects. eg ("Caption" or unique child object).
You can play around with object spy on your objects and find unique property to manually map two objects.
You can read more in this subject here ..using advance mapping setting is relevent to your question
if nothing helps, ask developers to inclued a unique property in to the object