Forum Discussion

Uwe_Raabe's avatar
Uwe_Raabe
Occasional Contributor
14 years ago

Replaying a TestRecorded file on another Windows

Hi,



I have successfully managed to record some user input to my application with TestRecorder on a Windows XP machine. I have imported this file into a TestComplete project for replay. But my TestComplete runs on Windows 7 and the replay gets stuck when a message box is displayed waiting for confirmation. It seems that TestComplete doesn't recognize the Windows 7 window as the one from Windows XP.



Can I do anything about that? (Perhaps some mapping)

Do I have to replay the recorded data on a similar system (Windows version, language) as it has been recorded?



Thanks,

Uwe Raabe

6 Replies

  • Hi,



    Can you describe the problem in detail? What exact code fails and what exact behavior do you observe?
  • Uwe_Raabe's avatar
    Uwe_Raabe
    Occasional Contributor
    During the recording on Windows XP there was a situation where a message dialog popped up requesting a Yes/No/Cancel decision,which was answered with a click at the No-button. The caption of the dialog is "Bestätigen", which is "Confirm" in German (mind the umlaut).



    The corresponding keyword test created by importing the recorded data expects a window named "wndBest_tigen" (the umlaut is mapped to an underscore).



    When I run that keyword test on Windows XP everything works fine, but when I run it on Windows 7 TestComplete waits for the message dialog until it times out. Of course the same exe is used for recording and playback.



    I converted the keyword test to a script and the offending line is:



    Aliases.twincam.wndBest_tigen.btnNein.ClickButton;   



    (TwinCAM is the application name and "Nein" is German for "No")
  • Uwe_Raabe's avatar
    Uwe_Raabe
    Occasional Contributor
    I just discovered that the window classes for the message dialog are different on WindowsXP (TMessageForm) and Windows 7 (#32770).



    This seems to be a consequence of Delphi 2010 checking for the OS in function MessageDlgPosHelp.



    The corresponding script for the Windows 7 version would be:



    Aliases.twincam.dlgBest_tigen.DirectUIHWND.CtrlNotifySink.btnNein.ClickButton;



    Is there a chance to cover this with some sort of mapping?
  • Hi,



    It looks like the problematic dialog is created in different ways in different Windows versions. I recommend that you ignore its window class and recognize it by caption or by message text.
  • Uwe_Raabe's avatar
    Uwe_Raabe
    Occasional Contributor
    Can you give me a hint how I can do that?



    I just imported the recorded data to a keyword test and later converted it to a script.



    Would it be better to work with the flat model?


  • Hi,



    In your code, where you address the problematic dialog, try replacing its window class (the first parameter of the Window method) with a wildcard. It looks like its caption alone should be unique enough to recognize it.