9 Using the Oracle Fusion/ADF Functional Test Module

This chapter provides instructions on configuring and using the OpenScript Oracle Fusion/ADF Functional Test Module, which provides support for functional testing of Oracle Application Development Framework (ADF)-based applications.

9.1 About the Oracle Fusion/ADF Functional Test Module

The Oracle Fusion/ADF Functional Test Module provides support for functional testing of Oracle Application Development Framework (ADF) applications. The Oracle Fusion/ADF Functional Test Module is an extension to the Web Functional Module. The Oracle Fusion/ADF Functional Test Module is fully integrated with the OpenScript platform including the Results view, Details view, Properties view, Console/Problems views, Preferences, Step Groups, Script Manager, and Workspace Manager.

The Oracle Fusion/ADF Functional Test recorder displays commands in the Tree View in easy-to-understand commands. By default, script commands are grouped into Steps Groups by the Web page on which they were performed. Each Step Group contains one or more script commands corresponding to recorded actions that were performed on the page. The default name for the Step Group is the ADF component name.

OpenScript shows the results of Oracle Fusion/ADF Functional Test script playback in the Results view. The Results view shows results for each script command (including duration and summary for failures). The Results Report compiles the same information into an HTML Results Report. Results can be exported from the OpenScript GUI in standard format (CSV / HTML). Results are also generated for unattended playback through the command line.

The Oracle Fusion/ADF Functional Test Module API includes a "adf" class that provides additional programming functionality.

9.1.1 Prerequisites

The Oracle Fusion/ADF Functional Test Module recorder has the following prerequisite:

  • Before recording any script in Oracle Fusion/ADF Functional Test Module, you must configure the ADF Server so that the ADF application uses uncompressed class names.

9.1.2 Key Features of the Oracle Fusion/ADF Functional Test Module

  • The Oracle Fusion/ADF Functional Test Script Module. The New Project wizard (Select New from the File menu) includes an "Oracle Fusion/ADF" option in the Functional Test Group to use when creating Oracle Fusion/ADF functional testing projects in OpenScript. The Oracle Fusion/ADF Functional Test Script Module records functional scripts against ADF Faces applications (Oracle Application Development Framework 11g Release 1 (11.1.1)).

  • ADF Functional-Specific Application Programming Interface (API). The Oracle Fusion/ADF Functional Test Module includes an ADF Functional Test Module API Specification that can be used to customize ADF Functional test-specific scripts.

9.2 Configuring the ADF Server

The Oracle Fusion/ADF Fusion Test Module recorder requires that the ADF application use uncompressed class names. You must configure the application server to specify that uncompressed class names are used for testing purposes.

There are three settings that must be configured in the following files on the ADF server:

  • WEB-INF/web.xml

  • trinidad-config.xml

9.2.1 Configuring the WEB-INF/web.xml File

This section explains the settings that must be specified in the ADF server web.xml file.

In the ADF server's WEB-INF/web.xml file, set the oracle.adf.view.rich. automation.ENABLED parameter to true. This is required in order for the Oracle Fusion/ADF Functional Test Module to find objects using scope IDs (also known as test IDs or Sub IDs).

The following XML shows how the oracle.adf.view.rich. automation.ENABLED parameter must be specified in the web.xml file before recording Oracle Fusion/ADF Functional Test scripts:

<context-param>
<param-name>oracle.adf.view.rich.automation.ENABLED</param-name>
<param-value>true</param-value>
</context-param>

In the ADF server's WEB-INF/web.xml file, set the org.apache.myfaces. trinidad.DISABLE_CONTENT_COMPRESSION parameter to true. This is required in order for the Oracle Fusion/ADF Functional Test Module to identify ADF component class names.

The following XML shows how the org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION parameter must be specified in the web.xml file before recording Oracle Fusion/ADF Functional Test scripts:

<context-param>
<param-name>org.apache.myfaces.trinidad.DISABLE_CONTENT_COMPRESSION</param-name>
<param-value>true</param-value>
</context-param>

9.2.2 Configuring the trinidad-config.xml File

This section explains the settings that must be specified in the ADF server trinidad-config.xml file.

In the ADF server's trinidad-config.xml, set the animation-enabled element to false.

The following XML shows how the animation-enabled element must be specified in the trinidad-config.xml file before recording Oracle Fusion/ADF Functional Test scripts:

<animation-enabled>false</animation-enabled>

9.2.3 Verifying the Compression Settings

This section explains how to verify that the ADF application is using uncompressed class names.

To verify the ADF application is using uncompressed class names:

  1. Navigate to the ADF site.

  2. Press F12 or select Developer Tools from the Tools menu.

  3. Click the HTML tab and check the elements of the DOM Tree. If the majority of the class names are in the form class="af_name", the ADF application is using uncompressed class names. If the majority of the class names are in the form class="x??", the ADF application is using compressed class names.

9.3 Recording Oracle Fusion/ADF Functional Tests

The Oracle Fusion/ADF Functional Test Module records standard ADF components for Oracle Application Development Framework 11g Release 1 (11.1.1). The Recorder creates functional test scripts for automating testing of Oracle Fusion/ADF applications.

ADF components are applet based controls and the Oracle Fusion/ADF Functional Test Module provides the object/attribute information for OpenScript to record interactions with those controls. Actions will be captured in the test script as OpenScript "adf" commands. Other components are standard Web controls which are captured as standard OpenScript "web" and "ft" navigation commands. Correlation rules can be modified by users through the Preferences settings for new scripts.

OpenScript plays back recorded ADF actions/commands which consist of an event plus an object identified by its attributes (for example: adf.inputText(11,"/web:window[@index='0' or @title='inputText Demo']/web:document[@index='0']/web:ADFInputText[@id='dmoTpl:idInputText' and @label='String value']").setValue("String"). The actions used for playback will either be those that are recorded or specified manually in the Java Code view. Unattended playback is supported through Oracle Test Manager or third-party tools using OpenScript's command line interface. Oracle Fusion/ADF Functional Test scripts do not play in Oracle Load Testing.

The Oracle Fusion/ADF Functional Test Module provides a record toolbar button that lets you initiate the ADF recorder and capture Web/ADF page actions to the script view. The record toolbar includes start and stop recording toolbar buttons. OpenScript recorders also open a floating toolbar that can be used while recording without having to switch between the browser and OpenScript.

9.3.1 Setting Oracle ADF Functional Test Record Preferences

To set Oracle ADF Functional Test record preferences:

  1. Start OpenScript.

  2. Select OpenScript Preferences from the View menu.

  3. Expand the OpenScript node and the Record category.

  4. Select Oracle ADF Functional.

  5. Click the tab and set the preferences. See Section 2.5.4, "Oracle ADF Functional Test Preferences" for descriptions of the Record Preferences settings.

  6. Click OK.

9.3.2 Adding/Editing Object Identifiers

The Oracle ADF Functional Test Module uses object identification to specify attributes used to identify Oracle ADF objects. The Oracle ADF Functional Test Module uses the same predefined path attributes for common Web objects as the Web Functional Test Module; however, Oracle ADF Test Automation provides additional attributes to identify ADF controls. Object paths are specified in XPath format. For example the object identification path appears as follows in Java code commands:

"/web:ADFCommandButton[@id='dmoTpl:usewindowButton' and @text='Click here']")

The full path to the control appears as follows:

adf.commandButton("/web:window[@index='0' or @title='commandButton Demo']" +
 "/web:document[@index='0' or @name='_afr_init_']" +
 "/web:ADFCommandButton[@id='dmoTpl:usewindowButton' and @text='Click here']")
 .click();

You can set the default Web object attributes in the Oracle ADF Functional Test Module Record Preferences. You can also edit object attributes in recorded scripts in the tree view or the code view.

In addition to the predefined object identification, you can add an Object Library to the script to record paths into a library file. Object Library files may be shared and reused across other scripts. The Object Library files provide a more convenient "short name" for objects to provide for more convenient programming.

The Oracle ADF Functional Test Module includes object identifiers that specify how the recorder identifies Browser objects. You can add object identifiers or edit the existing object identifiers in the Record preferences.

To add or edit an object identifier:

  1. Select the OpenScript Preferences from the View menu.

  2. Expand the Record node and select ADF Functional Test.

  3. Click the Object Identification tab. This tab lets you specify the Oracle ADF object identification attributes, as follows:

    Active Profile: Specifies which object identification profile to use as the active profile when recording scripts. Profiles define a specific set of object identifiers to use when recording ADF functional tests. Use the Add Profile option to create a new custom profile. Once you have created a profile, select the profile name in the Name column and use Add Object to define custom objects and attributes in the custom profile.

    Name: Shows the name(s) of the defined Oracle ADF object identifiers.

    Attributes: Shows the pattern(s) specified for the defined Oracle ADF object identifiers.

    Add Profile: Opens a dialog box for specifying a new Oracle ADF object identifier profile.

    Add Object: Opens a dialog box for specifying a new Oracle ADF object identifier.

    Edit: Opens a dialog box for editing the selected Oracle ADF object identifier.

    Delete: Deletes the selected Oracle ADF object identifier or custom profile. The default profile cannot be deleted.

    Export: Opens a dialog box for exporting the currently selected ADF object identifier profile to an XML file.

    Import: Opens a dialog box for importing a saved object identifier profile XML file.

    Revert: Reverts the default ADF object identification profile to the default profile. Any changes to the default profile are removed. Select the default profile name in the Name column to activate the revert option.

    For each object element, you specify a name (typically an Oracle ADF object attribute), an operator, a value and a value type. As you add object elements, OpenScript builds the object identifier using logical OR between each object identifier element. Click Edit to change between logical OR and AND.

  4. Click Add or select an existing object identifier and click Edit.

  5. If adding a new object identifier, enter a name for the object identifier.

  6. Add or edit object elements for the object identifier.

    See the Web Functional Test Module for additional information about adding and editing Object Identifiers.

  7. Click OK. The object identifier is added to the record preferences.

9.3.3 Recording Oracle Fusion/ADF Functional Test Scripts

To record ADF Functional Test scripts:

  1. Start OpenScript.

  2. Set the Oracle Fusion/ADF Functional Test Correlation preferences.

  3. Select New from the File menu.

  4. Expand the Functional Testing group.

  5. Select ADF (The Oracle Fusion/ADF script combines both Web and ADF technologies as part of the same script).

  6. Click Next.

  7. Select the Repository and Workspace.

  8. Enter a script name.

  9. Click Finish. A new Script tree is created in the Script View.

  10. Select Record from the Script menu. The browser automatically opens when you start recording.

  11. Load the web page where you want to start recording into the browser.

  12. Navigate the web site to record page objects, actions, and navigations. The page objects, actions, and navigations will be added to the node of the script tree specified by the Set Record Section setting (the Run node is the default).

  13. When finished navigating pages, close the browser.

  14. Select Stop from the Script menu or click the Stop button on the OpenScript toolbar.

  15. Expand the Run node of the script to view the page objects, actions, and navigation nodes in the script tree.

    You can customize the script using the menu options or the Code View for specific testing requirements.

    Note:

    Do not close the script editor view or script project while recording or playing back scripts. Doing so could result in unpredictable behavior in the OpenScript application.

9.4 Playing Back Scripts

OpenScript plays back recorded ADF actions/commands which consist of an object identified by its attributes. The actions used for playback will either be those that are recorded or specified manually in the Java Code view. Unattended playback is supported through Oracle Test Manager or third-party tools using OpenScript's command line interface.

The Oracle Fusion/ADF Functional Test Module provides playback and iterate toolbar buttons that allows users to start the script playback for either a single playback through the script or multiple iterations using data from a databank file. Playback results for Oracle Fusion/ADF Functional scripts can be viewed in the Results and Console views.

9.4.1 Playing Back Oracle Fusion/ADF Functional Scripts

To play back Oracle Fusion/ADF Functional scripts:

  1. Start OpenScript.

  2. Open the Oracle Fusion/ADF Functional script to play back.

  3. Select Playback from the Script menu or click the toolbar button.

    You can view the progress of the script playback in the Console View. You can review the results of script playback in the Results View.

9.4.2 Playing Back Oracle Fusion/ADF Functional Scripts with Iterations

To play back Oracle Fusion/ADF Functional scripts with iterations:

  1. Start OpenScript.

  2. Open the Oracle Fusion/ADF Functional script to play back.

  3. Select Iterate from the Script menu or click the toolbar button.

  4. Select Use Databanks.

  5. Select which databank file to specify the settings for if more than one database is configured for the script.

  6. Specify the settings for the databank file.

  7. Select the Run no more than [ ] iterations option and set the iteration count to the desired number of playback iterations. See Section 4.2.4, "Playing Back Scripts With Iterations" for additional information about iteration settings.

  8. Click OK.

    You can view the progress of the script playback in the Console View. You can review the results of script playback in the Results View.

9.5 Modifying Scripts

Once a script has been created/recorded, you can make modifications to customize the script for your specific testing needs.

9.5.1 Adding Fusion/ADF Actions

The Oracle Fusion/ADF Module includes actions for Oracle Fusion/ADF objects that can be added to a script.

To add Fusion/ADF actions to a script:

  1. Record a Fusion/ADF Functional Test script.

  2. Select the script node where you want to add the action.

  3. Select the Script menu and then select Other from the Add sub menu.

  4. Expand the ADF Action node.

  5. Expand an action node and select the action.

  6. Click OK.

  7. Enter the object identification path for the object. You can use the Capture or Select menu options to capture or select an object path.

  8. Enter any required values to use for the object action.

  9. Click OK. The action node is added to the script tree.

    In the Java Code view, an adf.object(objectId).action() method will be added to the script code:

    adf.inputText("/web:window[@index='0' or @title='inputText Demo']
        /web:document[@index='0' or @name='w0']
        /web:ADFInputText[@id='dmoTpl:idInputText' 
            and @label='']").setValue("My Text Input");
    

    The ADF Action node includes actions for objects such as Calendar, Command Button, Command Image Link, Command Link, Command Menu Item, Command Toolbar, Dialog, Guage, Go Menu Item, Graph, Input Color, Input Combobox List of Values, Input dateSelect ManyChoice, Input List of Values, Input Number Slider, Input Number Spinbox, Input Range Slider, Input Text, Menu, Navigation Page, Page, Panel Accordion, Panel Box, Panel, Splitter, Panel Tabbed, Panel window, Query, Quick Query, Reset Button, Rich Text Editor, Select Boolean Checkbox, Select Boolean Radio, Select Many Checkbox, Select Many Choice, Select Many Listbox, Select Many Shuttle, Select One Choice, Select One Listbox, Select One Radio, Select Order Shuttle, Show Detail, Show Detail Header, Table, Toolbar, Train, Train Button Bar, Tree, Tree Table. Other object actions have corresponding Java code methods.

9.5.2 Oracle Fusion/ADF Functional Test Module API

The Oracle Fusion/ADF Functional Test Module includes a script Application Programming Interface (API) specific to ADF functional testing. The Oracle Fusion/ADF Functional Test Module recorder creates the Java code that corresponds to the Tree View and displays the Oracle Fusion/ADF Functional Test commands in the Java Code view using easy-to-understand function names. The Java Code view commands correspond to the Tree View and you can edit your scripts in either view.

You can use the Oracle Fusion/ADF Functional Test API to enhance recorded scripts with additional testing functionality. Commands that are specific to the Oracle Fusion/ADF Functional Testing Module are part of the "adf" class. Additional test methods are available in the "web" or "ft" classes. You can also leverage other commands from other enabled classes (services) or general Java commands in your scripts.

Some examples of the Oracle Fusion/ADF Testing Module API include:

  • Calendar

  • Command Button

  • Command Image Link

  • Command Link

  • Command Menu Item

  • Command Toolbar

  • Dialog

  • Gauge

  • Go Menu Item

  • Graph

  • Input Color

  • Input Combobox List of Values

  • Input dateSelect ManyChoice

  • Input List of Values

  • Input Number Slider

  • Input Number Spinbox

  • Input Range Slider

  • Input Text

  • Menu

  • Navigation Page

  • Page

  • Panel Accordion

  • Panel Box

  • Panel Splitter

  • Panel Tabbed

  • Panel window

  • Query

  • Quick Query

  • Reset Button

  • Rich Text Editor

  • Select Boolean Checkbox

  • Select Boolean Radio

  • Select Many Checkbox

  • Select Many Choice

  • Select Many Listbox

  • Select Many Shuttle

  • Select One Choice

  • Select One Listbox

  • Select One Radio

  • Select Order Shuttle

  • Show Detail

  • Show Detail Header

  • Table

  • Toolbar

  • Train

  • Train Button Bar

  • Tree

  • Tree Table

Many API methods can be added using the Oracle Fusion/ADF Testing Module Tree View. Additional methods can be added using the Java Code view. Use Ctrl-space in the Java Code view to open an Intellisense window listing available procedures. See the API Reference in the OpenScript help for additional programming information.