Abstract:
A method and apparatus for generating dynamic test scripts enables the design and use of testing scripts that are independent of an application and the user interface layout of the application. The method and apparatus store a set of test data, checks and an action list independent from a test script. The test script matches the properties of the test data, checks and action list items with the properties of user interface elements in an application at run-time. The run-time matching allows for the script to be utilized for different applications as well as altered or updated versions of those applications with minimal or no changes to the testing script. This method and system are particularly relevant for the testing of applications using the user interface rather than backend utilities (APIs, services etc.).

Description:
FIELD OF THE INVENTION 
       [0001]    Embodiments relate to a method and system for testing applications. Specifically, embodiments relate to a method and system for generating dynamic test scripts that are application and user interface independent. 
       BACKGROUND 
       [0002]    Software developers and many software users that customize their software test the software and customizations to the software before releasing or distributing the software. The developers and entities that customize their software test their software manually or spend significant resources creating an automated test script. Several tools exist to assist in the development of test scripts including eCATT by SAP AG of Walldorf, Germany and HP-QTP by Hewlett-Packard of Palo Alto, Calif. However, these tools generate test scripts that are specific to the user interfaces of the applications that they are designed for. Even minor changes to the user interfaces of the applications that the test scripts are designed for can require significant changes in the test scripts to adapt them to the new user interface design. 
         [0003]    The test scripts are dependent on the specific layout (object layering/hierarchy, object type, screen coordinates, etc.) of the user interfaces of the applications being tested, because they are often created by recording a set of user actions within the user interface. The actions to be performed are recorded using tracked screen coordinates or the object hierarchy of the user interface object at the position in the screen that is being utilized. This information is recorded as static information that represents the application and user interface state at the time that it is recorded. 
         [0004]    The types of actions that are recorded by these test scripts include data input, data output and navigation actions that simulate end user interactions with the application. The automation of the testing process involves the recording of these actions in the test script. The actions can then subsequently be replayed to test an application. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0005]    Embodiments are illustrated by way of example and not by way of limitation in the figures of the accompanying drawings in which like references indicate similar elements. It should be noted that different references to “an” or “one” embodiment in this disclosure are not necessarily to the same embodiment, and such references mean at least “one.” 
           [0006]      FIG. 1  is a diagram of one embodiment of a system for dynamic test scripting. 
           [0007]      FIG. 2  is flowchart of one embodiment of a process for executing dynamic test scripts. 
           [0008]      FIG. 3  is a flowchart of one embodiment of a process for generating dynamic test scripts. 
           [0009]      FIG. 4A  is a diagram of one example embodiment of a user interface of an application being tested. 
           [0010]      FIG. 4B  is a diagram of one example embodiment of a user interface of the application being tested after a modification. 
       
    
    
     DETAILED DESCRIPTION 
       [0011]      FIG. 1  is a diagram of one embodiment of a system for dynamic test scripting. The system may include a server  101  and client systems  117 ,  123 . The server  101  and the client systems  117 ,  123  can be any type and combination of computer systems including desktop computers, handheld computers, laptop computers, servers, workstations or similar computing devices. The server  101  and the client systems  117 ,  123  can be in communication with each other over a network  111 . The network  111  can be a local area network (LAN), a wide area network (WAN), such as the Internet or similar communication system. For sake of convenience and clarity, a system with a single server  101  and two client systems  117 ,  123  is illustrated and described. However, one of ordinary skill in the art would understand that the principles, structures and features of the described system can be implemented on any number or combination of networked computer systems. 
         [0012]    In one embodiment, the server  101  includes or executes a testing program  103 . The testing program  103  enables the design and execution of testing scripts to test local or remote applications  115 . The testing program  103  can be accessed and utilized locally or through a remote testing client  121 . The testing program  103  includes a testing execution engine  125  and testing modules  105 . The testing execution engine  125  loads and executes the testing modules  105 . The testing execution engine  125  can communicate directly or indirectly with the testing client  121  and the applications  115  to be tested. The testing engine  125  can also provide an interface for defining and storing testing modules  105  through a testing client  121  or independently. 
         [0013]    The testing modules  105  store test scripts and a set of test data, a set of checks and an action list. The test data, checks and action list are defined independent of the screen layout of any application or user interface and independent of the test script. However test data, checks and action list can be specific to the transaction being tested (since it is specific to the business logic). The test data, checks and action list can be stored as separate tables or data structures or within a unified data structure in the form of a test data repository (TDR) such as a test data container (TDC) in eCATT by SAP AG of Walldorf, Germany or any combination thereof. Test data is data to be inserted, filled-in or input into an application through a specified field or user interface element. The test data can be defined by a developer or tester by direct programming or definition through the testing client or similar interface. 
         [0014]    Checks are comparisons of expected results of operations of the application with the actual output of the application. The checks can also be defined by a developer or tester by direct programming or definition through the testing client or similar interface. An action list is a navigation sequence or similar set of interactions with an application that can be defined by recording an interaction with the application or by direct programming or definition of the action list by a tester or developer. The developer or tester can also define alternate sets of interactions that can be selected at run-time or under similar circumstances. 
         [0015]    The test data, checks and action list are defined to include a set of properties for a corresponding user interface element. This information is utilized to match the test data, checks and actions in the action list with a user interface element of an application to be tested. For example, test data defines data that is to be input into a user interface element of the application. The value to be input is stored along with a set of characteristics or properties of the user interface element the data is to be input into, such as a type of the user interface element (e.g., a text input field), a size, identification infolination (e.g., field name or table name, position in hierarchy of screen objects, etc.) and similar user interface characteristic or property information. In one embodiment, the characteristics or properties of user interface elements exclude screen specific location information to enable the testing to be independent of screen layout. The user interface element with an exact match or a near match can be matched with the test data, check or item from an action list. 
         [0016]    The testing program can include or interface with a proxy module  109  and a screen reader  113 . These components can be a part of a separate dynamic testing extension  107  or integrated with the testing program  103 . The dynamic testing extension  107  can handle the interface between the testing program  103  and the external applications  115  and/or testing client  121 . The proxy module  109  can provide a set of user interface specific navigation tools or scripts to be selected and utilized by the screen reader  113  and/or testing design and execution engine  125  when mapping the user interface elements of the applications  115  to test data, checks and action list. At run-time of the testing module  105 , the screen reader  113  interfaces with the applications  115  and manages the communication of data between the testing program  103  and the applications  115 . The screen reader  113  can retrieve the user interface hierarchy and similar information about the user interface to generate a list of user interface elements and their corresponding properties to be matched with the test data, checks and action list of the testing module. 
         [0017]    A client system  117  can include a .NET framework by Microsoft Corporation of Redmond, Wash. to facilitate communication between the screen reader and the application. In some embodiments, the testing program includes or is implemented in conjunction with the above-mentioned eCATT. Any number of client systems  117 ,  123 , applications  115  and testing clients  121  can be part of the system and communicate with the server  101  and testing program  103 . In other embodiments, multiple servers  101  and/or instances of the testing program  103  can be part of the system. 
         [0018]      FIG. 2  is flowchart of one embodiment of a process for executing dynamic testing scripts. In one embodiment, the process is initiated through a testing client or similar interface of the testing program by the selection of a testing module. The testing engine then begins to execute the testing module. In one embodiment, the testing module includes a set of scripts including a transaction main script  231  and a generic masterscript  235 . The transaction main script  231  is executed by the testing engine and underlying computer system to manage the interaction between the application to be tested and the testing program. The transaction main script  231  can define a set of transaction specific actions to be executed prior to launching the application (Block  201 ). Transaction specific actions can include setting some system configuration parameters, data pre-processing, calculation of expected results etc. The transaction main script  231  then launches the application to be tested (Block  203 ). 
         [0019]    The generic master script  235  is then executed and invokes the screen reader to read the current screen of the application (Block  205 ). The screen reader generates a data structure representing the hierarchy of user interface elements or user interface objects including the basic attributes of the user interface elements such as an identifier, field name, value, status (e.g., changeable, hidden, etc.) and similar attributes. The data structure can be an extensible mark-up language string or document or similar data structure. The data structure can be organized to match the layout of the user interface elements on the screen. 
         [0020]    The process iterates through each element on a current screen or user interface of the application (Block  207 ). The user interface elements can be processed in any order. In one embodiment, the user interface elements are processed sequentially from an upper left position to a lower right position as they occur in the screen. The user interface elements can also be processed in lexicographical order, hierarchical order or similar order. The processing of the user interface elements in this iterative process is independent of any screen location information from the generic master script  235  or transaction main script  231 . 
         [0021]    For each user interface element identified in the current screen, test data  209  is retrieved from the test data repository or similar data structure and compared to the properties of the user interface element to determine whether there is a match (Block  211 ). The properties of the user interface element and test data  209  do not include screen location information. In one embodiment, the user interface element and test data  209  can be matched through the use of a unique semantic identifier. A unique semantic identifier can uniquely identify each user interface element independent of its location. The unique semantic identifier can include object hierarchy information or similar information that uniquely identifies a user interface element. 
         [0022]    If a match is found then the test data  209  is inserted or filled into the user interface element (Block  213 ). A match can be an exact match between the properties defined by the test data and the properties defined for the user interface element. However, these properties exclude screen location information enabling the process to handle any reorganization of the user interface elements within a screen including removal, addition and movement of user interface elements between screens. 
         [0023]    The interaction with the user interface element to fill in the test data can be performed by use of user interface control specific generic scripts from a library of such scripts in the proxy module or similar component of the system. These generic scripts can be utilized to perform any type of action for any type of user interface element. These user interface control generic scripts and associated library minimize the need to repetitively code interactions with each user interface element in a screen and avoid the need to directly code these aspects into the generic masterscript  235 . Thus, test logic (defined by the test case) is completely separated from the test implementation (handled by generic scripts). At run-time a sub-set of test data can be designated or defined by a user to be utilized in the script. 
         [0024]    For each user interface element identified in the current screen, checks  215  are retrieved from the test data repository or similar data structure and compared to the properties of the user interface element to determine whether there is a match (Block  217 ). The properties of the user interface element and checks  215  do not include screen location information. In one embodiment, the user interface element and test data  209  can be matched through the use of a unique semantic identifier. A unique semantic identifier can uniquely identify each user interface element independent of its location. The unique semantic identifier can include object hierarchy information or similar information that uniquely identifies a user interface element. 
         [0025]    If a match is found, then the checks  215  are executed to compare the expected value defined in the check against the value retrieved from the user interface element (Block  219 ). A match can be an exact match between the properties defined by the checks  215  and the properties defined for the user interface element. However, these properties exclude screen location information enabling the process to handle any reorganization of the user interface elements within a screen including removal, addition and movement of user interface elements between screens. 
         [0026]    The interaction with the user interface element to execute the check can be performed by use of user interface control specific generic scripts from a library of such scripts in the proxy module or similar component of the system. These generic scripts can be utilized to perform any type of action for any type of user interface element. These user interface control generic scripts and associated library minimize the need to repetitively code interactions with each user interface element in a screen and avoid the need to directly code these aspects into the generic masterscript  235 . At run-time a sub-set of checks  215  can be designated or defined by a user to be utilized in the script. 
         [0027]    For each user interface element identified in the current screen, an action list  221  is retrieved from the test data repository or similar data structure and compared to the properties of the user interface element to determine whether there is a match (Block  229 ). The properties of the user interface element and action list  221  do not include screen location information. In one embodiment, the user interface element and test data  209  can be matched through the use of a unique semantic identifier. A unique semantic identifier can uniquely identify each user interface element independent of its location. The unique semantic identifier can include object hierarchy information or similar information that uniquely identifies a user interface element. 
         [0028]    If a match is found with an item in the action list  221 , then that item is executed to the operation defined by the action list item on the matching user interface element (Block  223 ). A match can be an exact match between the properties defined by the action list  221  and the properties defined for the user interface element. However, these properties exclude screen location information enabling the process to handle any reorganization of the user interface elements within a screen including removal, addition and movement of user interface elements between screens. 
         [0029]    The interaction with the user interface element to execute the item of the action list  221  can be performed by use of user interface control specific generic scripts from a library of such scripts in the proxy module or similar component of the system. These generic scripts can be utilized to perform any type of action for any type of user interface element. These user interface control generic scripts and associated library minimize the need to repetitively code interactions with each user interface element in a screen avoid the need to directly code these aspects into the generic masterscript  235 . At run-time a sub-set of the action list or alternate action lists can be designated or defined by a user to be utilized in the script. 
         [0030]    After a user interface element is processed and compared with the test data, checks and action list, it is determined whether all of the user interface elements have been examined or exhausted (Block  225 ). If further user interface elements remain, then the process continues (Block  207 ) to iterate through each user interface element. If all of the user interface elements have been traversed, then the process logs the results of the testing (Block  227 ) and ends. The results can be logged into any type of file, provided to any type of recording program and/or displayed to the user through a testing client or similar interface. This process is activated for each screen of the application that is opened or activated. Actions in the action list may activate additional screens, in which case the process is queued, run in parallel, restarted, nested or similarly managed to accommodate additional or new screens being opened. 
         [0031]      FIG. 3  is a flowchart of one embodiment of a process for generating dynamic test scripts. In one embodiment, dynamic test scripts can be generated and stored as testing modules. The testing modules can be designed through a test script creator provided by a testing client or similar application. The test script program can be initiated in the testing program by the external testing client or a test script creator can be executed within the test script client independent of or in communication with the testing program (Block  301 ). A user such as a developer can define an action list to set forth a set of operations to be performed on an application (Block  303 ). The action list can be defined by directly entering items for the action list in a table or similar data structure to be stored in a test data repository. The action list can also be defined by recording the actions of a user or developer. The user or developer can also define attributes or characteristics of the user interface elements that correspond to each item of the test data. Alternate action lists can also be defined and stored in the test data repository or testing module. These alternate action lists can be selected by a user at run-time or during set up of testing. 
         [0032]    The test data can similarly be directly defined in a table or similar data structure of a test data repository by a user or developer (Block  305 ). The test data can also be defined by recording the specific fields in a transaction and storing this data in the TDC. The user or developer can also define attributes or characteristics of the user interface elements that correspond to each item of test data. The checks can similarly be directly defined in a table or similar data structure of a test data repository by a user or developer (Block  307 ). The user or developer can also define attributes or characteristics of the user interface elements that correspond to each item of test data. 
         [0033]      FIG. 4A  is a diagram of one example embodiment of a user interface of an application being tested. In the example embodiment, the application is a supply chain management application for managing the transport and delivery of products or goods. The user interface screen  400  has a number of user interface elements  407 , such as the Delivery Plant field  401  and search function button  409 . Each of these user interface elements  407  has a set of properties that can be utilized to identify the specific user interface element independent of its location. The screen reader can provide this information to the proxy module or testing engine as an extensible mark-up language (XML) document or similar data structure. An example document may include: 
         [0000]    
       
         
               
             
               
               
             
               
             
               
               
             
           
               
                   
               
             
             
               
                 &lt;?xml version=“1.0” encoding=“utf-8” ?&gt; 
               
             
          
           
               
                   
                   −  &lt;asx:abap xmlns:asx=“http://www.sap.com/abapxml” 
               
             
          
           
               
                 version=“1.0”&gt; 
               
             
          
           
               
                   
                   −  &lt;asx:values&gt; 
               
               
                   
                   −  &lt;DATA&gt; 
               
               
                   
                   −  &lt;COMPONENT&gt; 
               
               
                   
                  &lt;TYPE&gt;GuiCTextField&lt;/TYPE&gt; 
               
               
                   
                  &lt;PROGRAM_NAME&gt;SAPMV45A&lt;/PROGRAM_NAME&gt; 
               
               
                   
                  &lt;SCREEN_NO&gt;4001&lt;/SCREEN_NO&gt; 
               
               
                   
                  &lt;CHANGEABLE&gt;True&lt;/CHANGEABLE&gt; 
               
               
                   
                  &lt;LABEL /&gt;Deliver.Plant&lt;/LABEL&gt; 
               
               
                   
                 &lt;ID&gt;/app/com[0]/ses[0]/wnd[0]/usr/tabsTAXI_TABSTRIP —   
               
               
                   
                 OVERVIEW/tabpT\01/ssubSUBSCREEN_BODY:SAPMV4 
               
               
                   
                 5A:4400/ssubHEADER_FRAME:SAPMV45A:4440/ctxtRV45 
               
               
                   
                 A-DWERK&lt;/ID&gt; 
               
               
                   
                 &lt;NAME&gt;RV45A-TXT_VBELN&lt;/NAME&gt; 
               
               
                   
                 &lt;IS_TABLE&gt;False&lt;/IS_TABLE&gt; 
               
               
                   
                  &lt;/COMPONENT&gt; 
               
               
                   
                  &lt;/DATA&gt; 
               
               
                   
                   −  &lt;MESSAGE&gt; 
               
               
                   
                 &lt;ARBGB&gt;V1&lt;/ARBGB&gt; 
               
               
                   
                 &lt;TEXT /&gt; 
               
               
                   
                 &lt;TXTNR&gt;212&lt;/TXTNR&gt; 
               
               
                   
                 &lt;MSGTY /&gt; 
               
               
                   
                 &lt;MSGV1&gt;3020 07&lt;/MSGV1&gt; 
               
               
                   
                 &lt;MSGV2&gt;A&lt;/MSGV2&gt; 
               
               
                   
                 &lt;MSGV3&gt;1&lt;/MSGV3&gt; 
               
               
                   
                 &lt;MSGV4 /&gt; 
               
               
                   
                 &lt;PROGRAM_NAME&gt;SAPMV45A&lt;/PROGRAM_NAME&gt; 
               
               
                   
                 &lt;SCREEN_NO&gt;4001&lt;/SCREEN_NO&gt; 
               
               
                   
                 &lt;/MESSAGE&gt; 
               
               
                   
                 &lt;/asx:values&gt; 
               
               
                   
                 &lt;/asx:abap&gt; 
               
               
                   
                   
               
             
          
         
       
     
         [0034]    This example document shows only the encoding of the user interface element  401 . This data can be used to find and match this user interface element in any updated or modified version of the application. 
         [0035]    Similarly, action lists and checks can be defined either directly in code or through recording the interactions of a user or developer with the application. For example, the clicks on tabs  403  with a pointer  405  or similar interactions with the screen  400  can be recorded. This recording identifies the corresponding user interface elements using the properties of the user interface elements to enable reuse of the action list when the application is changed. 
         [0036]      FIG. 4B  is a diagram of one example embodiment of a user interface of the application being tested after being modified. The Delivery Plant field  401 B has moved to a new location in the user interface  400 . If the Delivery Plant field  401 B had been identified by its screen location in a test script, then the test script would have failed despite the field only having made a minor change in location on the same screen. However, when using the properties of the user interface element to locate the user interface element, such changes do not affect the execution of the test script. The same properties and relevant portion of the document that describes the user interface element are unchanged for both versions of the application. Thus, the test script can easily find and match the user interface element in its new location without any modification to the test script. 
         [0037]    Any number of modifications of this nature can be made to any number of the user interface elements location without requiring any changes to the testing script. The number of changes to the test script that may still be required are minimized and include new test data, checks or action items or the addition or removal of user interface elements. 
         [0038]    In one embodiment, the dynamic test scripting system can be implemented as a set of hardware devices. In another embodiment, the system components are implemented in software (for example microcode, assembly language or higher level languages). These software implementations can be stored on a non-transitory computer-readable medium. A non-transitory “computer-readable” medium can include any medium that can store information. Examples of the computer-readable medium include a read only memory (ROM), a floppy diskette, a CD Rom, a DVD, a flash memory, a hard drive, an optical disc or similar medium. 
         [0039]    In the foregoing specification, the invention has been described with references to specific embodiments. It will, however, be evident that various modifications and changes can be made thereto without departing from the broader spirit and scope that is set forth in the appended claims. The specification and drawings are accordingly to be regarded in illustrative rather than a restrictive sense.