Topic
9 replies Latest Post - ‏2013-01-31T14:08:16Z by xumin
SystemAdmin
SystemAdmin
16727 Posts
ACCEPTED ANSWER

Pinned topic Problem in identifying Objects in Swing application

‏2009-07-14T09:44:53Z |
Hi,

I am using Rational Functional Tester version 7.0.1.3. I need to automate a swing application. It is an executable file. While recording in RFT all objects are recording as

sunAwtFramewindow().click(atPoint(402,306));

Based on the co-ordinated only it is identifying.

How can i differentiate the objects? I need to include any file inside RFT?
Updated on 2013-01-31T14:08:16Z at 2013-01-31T14:08:16Z by xumin
  • SystemAdmin
    SystemAdmin
    16727 Posts
    ACCEPTED ANSWER

    Re: Problem in identifying Objects in Swing application

    ‏2009-07-15T12:02:27Z  in response to SystemAdmin
    I guess you clicked somewhere there is no other component (like a button) on your swing window.

    If you click on a button, the code generated should be something like:
    myButton().click(atPoint(15,15));
    


    Coordinates still exist, but relative to the button. It doesnt cause any problem most of the times.

    So if you want to add another test object to your script, just record an event for it, or add it using Script\Insert Test Object menu in RFT.
    Updated on 2014-03-25T18:38:32Z at 2014-03-25T18:38:32Z by iron-man
    • SystemAdmin
      SystemAdmin
      16727 Posts
      ACCEPTED ANSWER

      Re: Problem in identifying Objects in Swing application

      ‏2009-07-15T12:14:22Z  in response to SystemAdmin
      Hi,

      Thanks for the reply.

      If i click button also it is recording as sunAwtFramewindow() only.

      If i click Ok button in some alert messages it is recorded as

      alertwindow().click(atPoint(188,91));
      • SystemAdmin
        SystemAdmin
        16727 Posts
        ACCEPTED ANSWER

        Re: Problem in identifying Objects in Swing application

        ‏2009-07-15T13:02:22Z  in response to SystemAdmin
        Hmm there are many posts in this forum about swing and RFT. Did you search for them?
      • SystemAdmin
        SystemAdmin
        16727 Posts
        ACCEPTED ANSWER

        Re: Problem in identifying Objects in Swing application

        ‏2009-07-15T13:46:08Z  in response to SystemAdmin
        I created a sample swing app and successfully created a script on RFT 6.1.1.1.

        Attached is the swing sample. Could you try to script it?

        By the way, do you use both AWT and Swing in the same java class? It may be the cause of the problem.

        My generated script:
        
        
        
        import resources.Script1Helper;   
        
        import com.rational.test.ft.*; 
        
        import com.rational.test.ft.object.interfaces.*; 
        
        import com.rational.test.ft.object.interfaces.siebel.*; 
        
        import com.rational.test.ft.script.*; 
        
        import com.rational.test.ft.value.*; 
        
        import com.rational.test.ft.vp.*;   
        /** * Description   : Functional Test Script * @author T14340 */ 
        
        public 
        
        class Script1 
        
        extends Script1Helper 
        { 
        /** * Script Name   : <b>Script1</b> * Generated     : <b>15.Tem.2009 16:41:10</b> * Description   : Functional Test Script * Original Host : WinNT Version 5.1  Build 2600 (S) * * @since  2009/07/15 * @author T14340 */ 
        
        public 
        
        void testMain(Object[] args) 
        { startApp(
        "SwingSample"); 
        // Frame: Application jButton().click(); jTextField().click(atPoint(50,10)); application().inputChars(
        "fffg"); jButton().click(); jMenuBar().click(atPath(
        "File")); jMenuBar(ANY,MAY_EXIT).click(atPath(
        "File->Exit")); 
        } 
        }
        
        • SystemAdmin
          SystemAdmin
          16727 Posts
          ACCEPTED ANSWER

          Re: Problem in identifying Objects in Swing application

          ‏2009-07-16T08:43:30Z  in response to SystemAdmin
          Hi,
          Our application use both AWT and Swing. Is there any possibility to rectify the problem?
          • SystemAdmin
            SystemAdmin
            16727 Posts
            ACCEPTED ANSWER

            Re: Problem in identifying Objects in Swing application

            ‏2009-07-16T13:50:42Z  in response to SystemAdmin
            Added an awt button to my SwingSample and related script still works? I think you should search for the forum for swing related messages.
            
            
            
            import resources.Script1Helper;   
            
            import com.rational.test.ft.*; 
            
            import com.rational.test.ft.object.interfaces.*; 
            
            import com.rational.test.ft.object.interfaces.siebel.*; 
            
            import com.rational.test.ft.script.*; 
            
            import com.rational.test.ft.value.*; 
            
            import com.rational.test.ft.vp.*;   
            /** * Description   : Functional Test Script * @author T14340 */ 
            
            public 
            
            class Script1 
            
            extends Script1Helper 
            { 
            /** * Script Name   : <b>Script1</b> * Generated     : <b>16.Tem.2009 12:12:54</b> * Description   : Functional Test Script * Original Host : WinNT Version 5.1  Build 2600 (S) * * @since  2009/07/16 * @author T14340 */ 
            
            public 
            
            void testMain(Object[] args) 
            { startApp(
            "SwingSample"); 
            // Frame: Application awtButton().click(); jTextField().click(atPoint(68,8)); application().inputChars(
            "ertt"); swingButton().click(); jMenuBar().click(atPath(
            "File")); jMenuBar(ANY,MAY_EXIT).click(atPath(
            "File->Exit")); 
            } 
            }
            
  • xumin
    xumin
    9 Posts
    ACCEPTED ANSWER

    Re: Problem in identifying Objects in Swing application

    ‏2013-01-29T09:31:42Z  in response to SystemAdmin
    I'm sorry to push up a old topic, but i'm having the same problem.
    I'm using Rational Functional Tester 8.3.0, while recording in script in a Java application, all objects are recording as

    sunAwtCanvaswindow().click(atPoint(62,108));

    Is there any one know how to resolve this?
    • xumin
      xumin
      9 Posts
      ACCEPTED ANSWER

      Re: Problem in identifying Objects in Swing application

      ‏2013-01-29T10:43:39Z  in response to xumin
      More information about the environement and the tested application:
      Operating system = Windows Server 2003 R2 Standard Edition SP2
      The java application is launched by a click on an Html link.
      When i try to add object to map object using RFT, only the window of application is recognized as SunAwtFrame and a sub window as SunAwtCanvas. All other objects in the window of application can't be selected.
      If any one know resolve this, please let me know.
      • xumin
        xumin
        9 Posts
        ACCEPTED ANSWER

        Re: Problem in identifying Objects in Swing application

        ‏2013-01-31T14:08:16Z  in response to xumin
        I resolved the problem by enable the JRE used by the tested application.

        My tested application use JRE 6, obviously the IBM Rational SDP JRE (Version 7)enabled by default is not enough.