Unable to find Object via winform custom controls
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Unable to find Object via winform custom controls
Test language C# Script
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
1 name mapping
What should testers do if they are testing a application which generates all objects dynamically?
I give you an example:
**************test scripts************************************
1 powerTax_Main = Aliases["PowerTax_Main"];
2 gridControl = powerTax_Main["MainForm"]["MdiClient"]["WindowForm"]["AirlineView"]["AirlineWorkspace"]["AirlineGridWorkPage"]["AirlineGridWorkSpace"]["MetaViewer"]["rootTable"]["Content"]["ListFields"]["List"];
3 gridControl["ClickNewRowCellXY"]("Benefit Type", 49, 10);
4 gridControl["ClickNewRowCellXY"]("Benefit Type", 55, 10);
5 gridControl2 = powerTax_Main["PopupGridLookUpEditForm"]["GridControl"];
6 gridControl2["ClickCellXY"](0, "Code", 47, 8);
when I replay the testscript I recorded minutes ago, some of the objects in the test scripts are no longer exists. but some of them still remain in the memory, and my application will give the newly generated objects new name. Then how can I achieve the name mapping in test scripts?
2 Using find, findChild or findID.
findChild will be the last thing I want to do because I have to do many program to make it work, and I am not sure whether my program can really tame this method.. using findID, what if there is no ID for my custom controls?
3 Enumeration... Gosh. that' the pain in the AXX.. I have to do enumeration everytime when TC can't identify an object?what if I have more than 50 objects TC can't identify.. Do I need to do enumeration everytime? If i do that, i prefer to use manual testing because probably I could save more time....
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i had a lot of trouble in object recongition. i tried to use name mapping, or obj.refresh()..obj.refreshnamemappinginfo()..
all failed..
what should i do now?
another question is : can i add new name mapping definition into the exising name mapping list?
Thanks
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Philip,
As far as I understand, you are using Developer Express grid controls. We created a similar application which uses two lookup controls and reproduced the problem on our side. The problem is that there are two lookup grid controls on the same level of objects hierarchy, and therefore, TestComplete is using an index to identify them. However, the grid control which was activated last gets index 1 assigned due to the controls' implementation. Therefore, the new lookup grid is identified as the old one. Here is the script which demonstrates how you can avoid the problem:
function Test5()
{
var TestApp;
var gridControl;
var gridControl2;
TestApp = Aliases.TestApp;
gridControl = TestApp.MainForm.xtraTabControl.XtraTabPage.AddRemoveModifyMapContents.gridMapContents;
gridControl.ClickCellXY(0, "ArticleType", 104, 13);
TestApp.PopupGridLookUpEditForm.RefreshMappingInfo(); // IMPORTANT
gridControl2 = TestApp.PopupGridLookUpEditForm.GridControl;
gridControl2.ClickCellXY(1, "Type Name", 67, 6);
gridControl.ClickCellXY(0, "Product", 59, 11);
TestApp.PopupGridLookUpEditForm.RefreshMappingInfo(); // IMPORTANT
gridControl2.ClickCellXY(0, "Product Name", 69, 10);
}
Note that you need to call the RefreshMappingInfo method before retrieving each of the lookup grid controls - this will make TestComplete refresh the reference.
Best regards,
Alexey
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
