17 Using the Oracle JET Functional Test Module

This chapter provides instructions on configuring and using the OpenScript Oracle JET (Oracle JavaScript Extension Toolkit) Functional Test Module, which provides support for testing of Jet applications.

17.1 About the JET Functional Test Module

The Oracle JET Functional Test Module is an extension module to the OpenScript Web Functional Test Module that extends the Web testing with support for functional test record/playback of Oracle JET applications.

17.1.1 Key Features of the Oracle JET Functional Test Module

  • The Oracle JET Functional Test Script Module. The New Project wizard (New from the File menu) includes an "Oracle JET" option in the Functional Test Group to use when creating Oracle JET functional testing projects in OpenScript.

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

17.2 Recording Oracle JET Functional Tests

The Oracle JET Functional Test Module records standard JET-specific components for JET v2.1. The Recorder creates functional test scripts for automating testing of JET web applications.

Oracle JET components are object based controls and the Oracle JET Functional Test Module provides the object/attribute information for OpenScript to record interactions with the JET controls. Actions will be captured in the test script as OpenScript "jet" commands. Other components are standard Web controls which are captured as standard OpenScript "web" and "ft" navigation commands.

OpenScript plays back recorded JET actions/commands which consist of an event plus an object identified by its attributes (for example: jet.accordion("/web:window[@index='0' or @title='Accordion - Accordion']/web:document[@index='0']/web:JETAccordion[@id='accordionPage'").expand('c1');. 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 JET Functional Test Module provides a record toolbar button that lets you initiate the JET recorder and capture Web/JET 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.

17.2.1 Setting Oracle JET Functional Test Preferences

To set Oracle JET Functional Test preferences:

  1. Start OpenScript.

  2. Open or record an Oracle JET script.

  3. Select OpenScript Preferences from the View menu.

  4. Expand the OpenScript node and the Record category.

  5. Select Oracle JET Functional.

  6. Click the tab and set the preferences. See Section 2.5.9, "Oracle JET Functional Test Preferences" for descriptions of the Record Preferences settings.

  7. Click OK.

17.2.2 Adding/Editing Object Identifiers

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

"/web:JETAccordion[@id='accordionPage'")

The full path to the control appears as follows:

jet.accordion(525,"/web:window[@index='0' or @title='Accordion - Accordion']" +
 "/web:document[@index='0']" +
 "/web:JETAccordion[@id='accordionPage'")
 .expand('c1');

You can set the default Web object attributes in the Oracle JET 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 JET 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 Oracle JET Functional.

  3. Click the Object Identification tab. This tab lets you specify the Oracle JET 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 Oracle JET 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 JET object identifiers.

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

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

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

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

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

    Export: Opens a dialog box for exporting the currently selected Oracle JET 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 Oracle JET 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 JET 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.

17.2.3 Recording Oracle JET Functional Test Scripts

To record Oracle JET Functional Test scripts:

  1. Start OpenScript.

  2. Select New from the File menu.

  3. Expand the Functional Testing group.

  4. Select Oracle JET (The Oracle JET script combines both Web and Oracle JET technologies as part of the same script).

  5. Click Next.

  6. Select the Repository and Workspace.

  7. Enter a script name.

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

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

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

  11. 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).

  12. When finished navigating pages, close the browser.

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

  14. 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.

17.3 Playing Back Scripts

OpenScript plays back recorded Oracle JET 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.

The Oracle JET Functional Test Module uses the OpenScript playback and iterate toolbar buttons which 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 JET functional test scripts can be viewed in the Results and Console views.

17.3.1 Playing Back Oracle JET Functional Scripts

To play back Oracle JET Functional scripts:

  1. Start OpenScript.

  2. Open the Oracle JET functional test 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.

17.3.2 Playing Back Oracle JET Functional Scripts with Iterations

To play back Oracle JET functional test scripts with iterations:

  1. Start OpenScript.

  2. Open the Oracle JET functional test 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.

17.4 Modifying Scripts

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

17.4.1 Adding Oracle Jet Actions

The Oracle JET Module includes actions for Oracle JET control objects that can be added to a script.

To add Oracle JET actions to a script:

  1. Record an Oracle JET 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 JET Actions node.

  5. Expand the control type 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 jet.object(objectId).action() method will be added to the script code:

    jet.accordion(525,"/web:window[@index='0' or @title='Accordion - Accordion']" +
     "/web:document[@index='0']" +
     "/web:JETAccordion[@id='accordionPage'")
     .expand('c1'); 
    

    The JET Action nodes includes actions for objects such as accordion, button, chart, collapsible, combobox, dataGrid, dialGauge, dialog, filmStrip, indexer, inputDate, inputDateTime, inputNumber, inputPassword, inputSearch, inputText, inputTime, jSwitch, ledGauge, listView, menu, navigationList, pagingControl, popup, progressbar, ratingGauge, select, slider, statusMeterGauge, table, tabs, textArea, train, tree.

17.4.2 Oracle JET Functional Test Module API

The Oracle JET Functional Test Module includes a script Application Programming Interface (API) specific to JET functional testing. The Oracle JET Functional Test Module recorder creates the Java code that corresponds to the Tree View and displays the JET 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 JET Functional Test API to enhance recorded scripts with additional testing functionality. Commands that are specific to the JET Functional Testing Module are part of the "jet" 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 JET Testing Module API include:

  • accordion

  • button

  • chart

  • collapsible

  • combobox

  • dataGrid

  • dialGauge

  • dialog

  • filmStrip

  • indexer

  • inputDate

  • inputDateTime

  • inputNumber

  • inputPassword

  • inputSearch

  • inputText

  • inputTime

  • jSwitch

  • ledGauge

  • listView

  • menu

  • navigationList

  • pagingControl

  • popup

  • progressbar

  • ratingGauge

  • select

  • slider

  • statusMeterGauge

  • table

  • tabs

  • textArea

  • train

  • tree

Many API methods can be added using the JET 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.