Forum Discussion

chris_adair's avatar
chris_adair
Occasional Contributor
15 years ago

Having trouble with XtraMainMenu Click events in TestComplete 7.5.2

I have JScript scripts that I have written in Test Complete 6.  They use the XtraMainMenu property of a window to click the Menu items on the menu bar.  I have converted my scripts into Test Complete 7, and anytime I get to a point in the script that it tried to Click in the menu item, the script fails.   Sometimes it fails on the first attempt, others the second attempt, if it is in a loop.  The code I have is similar to the following:



wMain.XtraMainMenu.Click("File|Close");



In these cases wMain is the windows object that has the XtraMainMenu property.  If I reset the wMain just before I call the Click command, then it seems to work, however, this does not make sense since wMain should not have changed since it was first initialized.



wMain = Sys.Process("My Program").WinFormsObject("MyWindow")...etc

wMain.XtraMainMenu.Click("File|Close");



Resetting wMain each time seems to work, but I do not want to have to do this for each time I need to click the menu; as i did not have to do so in Test Compelte 6.  Any help would be appreciated.

Thanks!

Chris

3 Replies

  • Hi Chris,


    The behavior you observe means that the wMain reference becomes invalid for some reason. The behavior is usually caused by the tested application (for example, if some objects are recreated due to controls' implementation). You may not have noticed the change (for example, if the developers moved to a newer version of controls, which behaves differently or just changed some logic). Actually, refreshing references in script is a common practice which makes your tests more stable. However, if you observe different results with TestComplete 6.53 and TestComplete 7.52 (the latest version of TestComplete 6 and 7), and the latest version requires refreshing the reference more often, we would appreciate it a lot if you sent us a simple application with which the behavior can be reproduced. BTW, can it be reproduced with a sample application shipped with the Developer Express controls? If the problem cannot be reproduced with the sample application, most probably, it is related to your tested application's implementation, not to the controls.


  • chris_adair's avatar
    chris_adair
    Occasional Contributor
    Hi Allen,

    Our application has not used newer controls since I ran the scripts in Test Complete 6.53.  I create a function to recapture the XtramMainMenu object each time I need to call it, and that seems more stable now.  I do not have access to sample DevXpress projects to try to reproduce this with.  If you have a link to any, I can take a look, but internally here, I do not have access.

    Thanks,

    Chris