|
Post by leiwang on Aug 4, 2020 7:57:48 GMT
IBM Rational Functional Tester V6 and later supports the testing of Win32 and .NET windows and applications. However, these environments are not enabled for testing in the traditional means as seen for Java and other environments. These environments require what Rational calls 'dynamic enabling'. We use the class DynamicEnabler to enable these applications dynamically. This class uses external resource file ' WindowsClassMap.dat' to indicate which classes running on the system are to be enabled. By default, we don't put any classes in that file as the dynamical enabling may waste some time if user doesn't need to test Win32 and .NET windows and applications. The file 'WindowsClassMap.dat' is under folder c:\SAFS\lib, it contains pairs of (name, class-name), such as below: DialogWin :#32770 Excel :XLMAIN Notepad :Notepad.* TextPad :TextPad.* The name can be anything as user wants. The class-name should be the application's top window's class-name, it can be got by "RFT Inspector", please refer to Inspect Win or .Net application by RFT. Below is a snapshot showing how we get the Notepad top window's classname The class-name can be exact or can be wild-card by .* If we put the pair (Notepad :Notepad.*) into file c:\SAFS\lib\WindowsClassMap.dat, we should be able to test the Notepad-application with RFT.
|
|
|
Post by leiwang on Aug 4, 2020 8:13:49 GMT
Be careful, we should run the test as Administrator, otherwise we will fail to run the test. It appears that RFT is trying to find the Windows object (here we test Notepad as example) again and again and finally meet the timeout 30 seconds. If we open the debug log, we can find the following messages showing that we meet an UnableToHookException.
[INFO 13:18:58.612:SAFS/RobotJ: DynamicEnabler simpleEnableTopWins: find window with pid=3628; classname=Notepad ................. ] [INFO 13:18:58.612:SAFS/RobotJ: ============== Try to enable pid=3628; classname=Notepad ................. ] [WARN 13:18:58.614:SAFS/RobotJ: DynamicEnabler failed to enable class Notepad with pId 3628 due to UnableToHookException ]
If we run the test as Administrator, the test will find the Windows object (here we test Notepad as example) and the test goes well. In the debug log, the messages tell us that the Notepad is dynamically enabled.
[INFO 14:05:37.984:SAFS/RobotJ: DynamicEnabler simpleEnableTopWins: find window with pid=17816; classname=Notepad ................. ] [INFO 14:05:37.984:SAFS/RobotJ: ============== Try to enable pid=17816; classname=Notepad ................. ] [INFO 14:05:38.088:SAFS/RobotJ: DynamicEnabler ENABLED process containing: Notepad; pId: 17816; hWnd: 923416; IWIN: window:e1718 Untitled - Notepad Notepad java.awt.Rectangle[x=1243,y=88,width=626,height=394] ]
|
|