Skip Headers
Oracle® Application Testing Suite Getting Started Guide
Version 9.01 for Microsoft Windows (32-Bit)

Part Number E15487-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

4 Oracle Functional Testing for Web Applications Tutorial

This tutorial walks you through the main features of Oracle Functional Testing for Web Applications. The tutorial consists of the following examples:

The tutorial is designed to be followed sequentially from beginning to end. Many of the examples are interrelated and build upon the steps in previous examples.

Initializing the Tutorial

The tutorial uses two versions of web pages to demonstrate the capabilities of Oracle Functional Testing for Web Applications. To make sure the initial version of the tutorial web pages is the current version, do the following:

  1. Select Programs from the Start menu and then select Build A - Home Superstores from the Oracle Application Testing Suite submenu. A command window will appear briefly as the batch file copies the Build A files.

  2. Close the command window, if necessary.

Example 1: Recording a New Visual Script

This example illustrates the creation and recording of a Visual Script.

Start Oracle Functional Testing for Web Applications

  1. Select Programs from the Start menu and then select Oracle Functional Testing for Web Applications from the Oracle Application Testing Suite submenu to start Oracle Functional Testing for Web Applications.

  2. Select Open Workspace from the File menu, select RSWDemo as the Workspace, and click OK to get to the main window.

    Note:

    If you installed this version of the Oracle Application Testing Suite over a previous version, your default installation directory will still be the old directory. If this version is the first time you installed the Oracle Application Testing Suite, the default installation directory is c:\OracleATS\OFT.
  3. Type c:\OracleATS\OFT\rswdemo\index.htm in the URL drop down list and then press ENTER. (The tutorial assumes that you installed Oracle Functional Testing for Web Applications in the default c:\OracleATS\OFT directory. If you installed to another directory, enter the appropriate path.)

    Figure 4-1 Oracle Functional Testing for Web Applications Main Window

    Image of the Oracle Funtional Testing main window.
    Description of "Figure 4-1 Oracle Functional Testing for Web Applications Main Window"

    Oracle Functional Testing for Web Applications opens the Home Superstores tutorial Web page into the Browser pane.

Start a Recording

  1. Select New Script from the File menu and select No if asked to save changes to Script1.

  2. Click the Record button on the toolbar. Oracle Functional Testing for Web Applications is now recording your actions as indicated by the REC in the status bar. The [1] Welcome - Home Superstores Inc. title is recorded into the Visual Script pane.

Navigate the Web Site

  1. Click on the Kitchen and Bath link on this page. The Kitchen and Bath page appears in the Browser pane and the address should show c:\OracleATS\OFT\rswdemo\kitchen.htm. You should now see [2] Kitchens - Home Superstores Inc. in the Visual Script.

  2. Click on the Lighting link on this page. The Lightings page appears in the Browser pane and the address should show c:\OracleATS\OFT\rswdemo\lighting.htm. You should now see [3] Lightings - Home Superstores Inc. in the Visual Script.

  3. Click on the Electronics link on this page. The Home Electronics page appears in the Browser pane and the address should show c:\OracleATS\OFT\rswdemo\etronics.htm. You should now see [4] Electronics - Home Superstores Inc. in the Visual Script.

Stop the Recording

  1. Click the Stop button on the toolbar to stop the recording. The Visual Script pane should list four pages in the script.

Save the Script

  1. Select Save Script from the File menu to save the script. The autonaming feature initially defaults the name of a new script to Script1.

  2. Type in tutor1 for the name of the script in the Save As dialog box and click Save.

Example 2: Working with Visual Scripts

This example explains the features of the Visual Script tree and how to examine the structure and content of a Web page. It also explains how to modify the built-in Oracle Functional Testing for Web Applications tests.

Before starting this example, make sure the Visual Script that you recorded in Example 1 is still displayed.

  1. Select Resize Visual Script View from the View menu to expand the Visual Script pane.

  2. Click the [1] Welcome - Home Superstores Inc. node in the Visual Script and then click the Plus next to the node. The script shows the Address and Frame nodes to the page tree.

  3. Click the right mouse button and select Expand Page to show the entire page tree, which should look similar to the following:

Figure 4-2 Oracle Functional Testing Visual Script Tree

Oracle Funtional Testing Visual Script Tree.
Description of "Figure 4-2 Oracle Functional Testing Visual Script Tree"

The [1] Welcome - Home Superstores Inc. page contains the following nodes in the tree:

Viewing Information About a Visual Script Item

  1. Select the HTML node in the Visual Script.

  2. Click the right mouse button and select HTML Properties. The following dialog box is displayed:

    Figure 4-3 HTML Properties Dialog Box

    HTML Properties dialog box.
    Description of "Figure 4-3 HTML Properties Dialog Box"

    You can get more information about any item in the Visual Script using the Properties option. The properties for the different items vary.

  3. Close the Properties dialog box.

  4. Repeat steps 5 and 6 with any other items in the tree and view the properties.

Turning Automatic Testing On and Off

  1. Select the Frame node in the Visual Script.

  2. Click the right mouse button and select Don't Test Frame. Notice a small yellow circle appears next to the Frame node to indicate that the automatic existence test for the frame is turned off, as shown below:

    Figure 4-4 Visual Script Frame Node

    Visual Script Frame Node
    Description of "Figure 4-4 Visual Script Frame Node"

  3. Click the right mouse button and select Test Frame. The yellow circle disappears to indicate that the automatic existence test is activated.

    Note:

    Oracle Functional Testing for Web Applications maximizes your productivity by virtually eliminating the need to program test scripts. When a Visual Script is recorded, it captures your interaction with the Web application under test. A series of default test cases are automatically generated and added to the Visual Script. These tests are designed for Images, Links, Frames, Forms, Elements, HTML, Java Applets, ImageMaps, and Active-X controls and can be customized to suit your requirements.

Modifying Default Tests

  1. Select Current Script (tutor1) from the Options menu and then select Content Tests in the Functional Tests section.

    Figure 4-5 Script Options Dialog Box

    Script Options Dialog Box
    Description of "Figure 4-5 Script Options Dialog Box"

    This dialog box indicates which comparison tests will be performed on which page attributes as default tests for the current script. You can enable or disable testing of specific attributes by selecting or clearing the appropriate check box(es). You can set global defaults for all Visual Scripts by selecting New Scripts (Global) from the Options menu and then selecting Content Tests in the Functional Tests section.

  2. Make sure the following check boxes are selected:

    • HTML.

    • Images.

    • Scripts.

    • Links.

    • Frames.

  3. Click OK.

  4. Select the [1] Welcome - Home Superstores Inc. node in the Visual Script.

  5. Click the right mouse button and select Page Content Tests Manager. The Content Tests Manager dialog box opens.

    Figure 4-6 Content Tests Manager Dialog Box

    Content Tests Manager Dialog Box
    Description of "Figure 4-6 Content Tests Manager Dialog Box"

    This dialog box indicates which comparison tests will be performed on which page attributes as default test cases for a specific page. You can enable or disable testing of specific page attributes by selecting or clearing the appropriate check box(es), and clicking the OK button.

  6. Clear the Images check box, and press the OK button. A yellow circle appears next to the Images node in the Visual Script for the image collection, as shown below:

    Figure 4-7 Images Script Node

    Images script node
    Description of "Figure 4-7 Images Script Node"

    When the Visual Script is played back, all Image tests will be ignored.

Example 3: Playing Back a Visual Script

This example explains the procedure for playing back Visual Scripts that you have recorded. It also shows the option settings for playback and the results log.

  1. Select Current Script from the Options menu and then select Results Log in the Results section. Make sure the Append to log and All details radio buttons are selected.

  2. Select Results Report in the Results section and make sure the Automatically create report after script playback option is selected.

  3. Select General in the Playback section, make sure the Automatically Run Resource Validation After Playback check box is selected, and then click OK.

  4. Select Resize Visual Script View from the View menu to expand the Browser pane.

  5. Click the Playback Script button to play back the recorded script. The pages in the script will be played back in the order recorded. The Browser navigates to each page, executes the default tests for each page, and shows the results visually in the script. At the end of the play back, Oracle Functional Testing for Web Applications runs a Resource Validation test and shows the results.

    The Resource Validation test checks the integrity of the referenced resources (i.e. links, images, etc.) in your pages.

    Figure 4-8 Resource Validation Window

    Resource Validation window
    Description of "Figure 4-8 Resource Validation Window"

    The "passed" results indicate that all referenced resources are available.

  6. Click the Close button to close the Resource Validation window.

    Oracle Functional Testing for Web Applications automatically generates a results report and opens the report in a new browser window:

    Figure 4-9 Results Report Window

    Results Report window
    Description of "Figure 4-9 Results Report Window"

    Note:

    The Results Report uses active content. If the links in the report are not working, check if the browser shows the restricted active content security warning at the top of the browser. If so, click on the warning and select Allow Blocked Content. Use the browser Internet Options to set the default settings for allowing active content. Select Browser from the Options menu and click the Advanced tab. Select the Allow active content to run in files... setting under the Security section if you do not want the restricted active content security warning to appear each time the Results Report is generated.
  7. Click on the page names in the Script Summary section to view the information for each page.

    Notice that all tests passed. This is because you played back the script using the same version of the Web pages that was used to record the script. This establishes a baseline of tests for the Web application or Web site's content and structure.

  8. Close the browser window when finished with the report.

    The Results pane also shows a summary of the playback actions.

    Figure 4-10 Playback Results Pane

    Playback Results pane
    Description of "Figure 4-10 Playback Results Pane"

    In the next example, you'll see how playback and the results are affected by Web page changes.

Example 4: Analyzing Test Failures

This example explains how to analyze the differences found between the baseline Web pages and a new version with changes. The Oracle Functional Testing for Web Applications tutorial includes a batch file that copies a new version of three of the pages that you recorded in Example 1.

  1. Select Programs from the Start menu and then select Build B - Home Superstores from the Oracle Application Testing Suite submenu. This runs a batch file that updates the Home Superstores page to a new version.

  2. If necessary, close the command window after the batch file finishes copying the files.

  3. Click the Playback Script button to play back the recorded script again. The pages are played back in the order recorded.

    The resource validation test found one resource that failed. There is one failed image called moviei.gif. The results of the resource validation test are displayed in the output log window and the failure will be displayed under the appropriate pages with red flags.

  4. Click the Close button to close the Resource Validation window and close the Results Report browser window.

  5. Notice the red circles next to the pages in the Visual Script, as shown below:

    Figure 4-11 Visual Script with Failure Markers

    Visual Script with failure markers
    Description of "Figure 4-11 Visual Script with Failure Markers"

    Note:

    Oracle Functional Testing for Web Applications displays errors and problems encountered during playback using simple color-coded circles in the script itself. Test results are displayed dynamically in the Visual Script tree as the script is being played back. You can double-click on any error event in the result log pane to advance to the corresponding page in the script. Errors encountered upon Visual Script playback can be rejected, ignored, or can be accepted to create a modified baseline script.
  6. Select Find Next Failure from the Results menu, or press the F3 key to locate the next failure in the Visual Script. The first page [1] Welcome - Home Superstores Inc. has two places where differences are indicated: Different HTML and New Links with two new links under the Tested node. The new links are admlist.htm and adminfo.htm.

Ignoring Failures

Occasionally, you may want to ignore a known problem or discrepancy that does not affect the overall test being performed.

  1. Locate the Master: Html node under the Different Html node.

    Figure 4-12 Different Html Script Node

    Different Html script node
    Description of "Figure 4-12 Different Html Script Node"

  2. Click on the Different Html node, and then click the right mouse button and select Ignore This Failure. This adds a yellow circle to the Different Html node to indicate that the failure caused by the HTML change should be ignored, as follows:

    Figure 4-13 Ignore This Failure Script Node Marker

    Ignore This Failure script node
    Description of "Figure 4-13 Ignore This Failure Script Node Marker"

  3. Press the F3 key to get to the New Links item and expand the Tested node to view the new links.

    Figure 4-14 New Links Script Node

    New Links script node
    Description of "Figure 4-14 New Links Script Node"

  4. Click on the New Links item, and then click the right mouse button and select Ignore This Failure. This adds a yellow circle to the New Links node to indicate that the failure caused by the presence of new links should be ignored.

    Figure 4-15 New Links Script Node with Marker

    New Links script node
    Description of "Figure 4-15 New Links Script Node with Marker"

Accepting Changes Shown in the Script

Often, you will get new versions of Web pages that you want to use as the new baseline for testing.

  1. Follow the red circles in the [2] Kitchens - Home Superstores Inc. page.

    The problems on this page are indicated by the presence of two nodes called Different Html and Different Script. Below the Different Html node are the recorded and tested versions of the HTML for the current page. Below the Different Script node are the recorded and tested versions of the JavaScript function that has changed for the current page.

    Figure 4-16 Different Html and Different Script Nodes

    Different Html and Different Script script nodes
    Description of "Figure 4-16 Different Html and Different Script Nodes"

  2. Double-click on the Different HTML node and a dialog box with the differences for the HTML opens.

  3. Click Next Difference as many times as necessary to locate the following differences between Master and Tested page HTML source.

    Figure 4-17 Master and Tested Page HTML Source Differences

    Master and Tested Page HTML Source Differences
    Description of "Figure 4-17 Master and Tested Page HTML Source Differences"

    Notice that the changes are textual changes to the Web page content. The Master text (baseline for testing) is shown in blue. The tested text (new version) is shown in red.

  4. Click the Cancel button to close the window.

  5. Repeat the same process for the Different Script node.

  6. Select the [2] Kitchens - Home Superstores Inc. page node and select Accept Tested Page from the right-click shortcut menu. The red circles in the Visual Script for that page disappear. The accepted change becomes the new baseline for future testing of this page.

Rejecting Problems Shown in the Script

There may be times when you do not want a change to a Web page to be accepted as the new baseline for testing.

  1. Follow the red circles in the [4] Electronics - Home Superstores Inc. page.

    The problems on this page are indicated by the presence of two nodes called Different Html and Different Image. Below the Different Html node are the recorded and tested versions of the HTML for the current page. Below the Different Image node are the recorded and tested versions of the image found on this page.

  2. If necessary, expand the Different Image node to display the Master and Tested Image nodes. You will notice that the file name of the image file is spelled differently [movie vs. movei]

    Figure 4-18 Master and Tested Image Differences

    Master and Tested Image Differences
    Description of "Figure 4-18 Master and Tested Image Differences"

    The Master node has a red circle because playback revealed that the link to the image is no longer in the HTML. The Tested node has a red flag because the image failed the Resource Validation test.

  3. Double click on the Different HTML node and you will see the same spelling change in the HTML source for the page.

    Figure 4-19 Master and Tested Image Differences

    Master and Tested Image Differences
    Description of "Figure 4-19 Master and Tested Image Differences"

    We wish to discard these differences and continue to use the original spelling as the baseline for testing in the Visual Script.

  4. Click the Cancel button.

  5. Select the [4] Electronics - Home Superstores Inc. page node and select Discard Tested Page from the right-click shortcut menu. This causes the originally recorded baseline to be left intact. The baseline differences will be discarded and all red circles will be removed.

  6. Click the Playback toolbar button to play back the script again. Oracle Functional Testing for Web Applications still flags the Different HTML and the image name spelling problem in the [4] Electronics - Home Superstores Inc. page of the Visual Script.

  7. Close the Resource Validation window and the Results Report.

  8. Select Save Output Log As from the File menu.

  9. Enter the name tutor1.log and click Save.

  10. Select Save Script from the File menu to save the changed Visual Script.

  11. Select Clear Results Window from the View menu to clear the results log pane.

Example 5: Adding Test Cases to the Visual Script

This example explains how to add four types of test cases to your Visual Scripts. In addition to the automatic existence and resource validation tests, Oracle Functional Testing for Web Applications provides the ability to add the following test cases to the pages in your Visual Script:

Record a New Script

  1. Select Programs from the Start menu and then select Build A - Home Superstores from the Oracle Application Testing Suite submenu. This batch file restores the original Web pages for the Home Superstores site.

  2. If necessary, close the command window.

  3. Select New Script from the File menu to create a new Visual Script.

  4. Reload the c:\OracleATS\OFT\rswdemo\index.htm page in the Browser pane by selecting it from the Browser drop-down list.

  5. Click the Record button on the toolbar.

  6. Click on the Register link in the Browser pane. The Registration page appears in the Browser pane and the address should show c:\OracleATS\OFT\rswdemo\register.htm.

  7. Type Admin as the first name, enter any email address, and phone in the text area, and click the submit my entry button. The Browser returns the Database Authorization and Administration options of he registration page (regres.htm).

Stop the Recording

  1. Click the Stop button on the toolbar to stop the recording. The Visual Script pane should list three pages in the script.

Insert a Text Matching Test Case

Text Matching test cases compare selected text from a Web page to the text you specify in the test case.

  1. Select [3] Registered - Home Superstores, Inc. in the Visual Script.

  2. Click the right mouse button and select Goto Page to open the Registered - Home Superstores, Inc page in the Browser.

  3. Scroll the Browser pane so that the text "Database Authorization and Administration" is visible.

  4. Highlight the "Database Authorization and Administration" text with the mouse.

  5. Click the Insert Text Matching Test Case button on the toolbar.

    Oracle Functional Testing for Web Applications captures the highlighted text and opens the Insert Text Matching Test Case dialog box.

    Figure 4-20 Text Matching Test Properties Dialog Box

    Text Matching Test Properties Dialog Box
    Description of "Figure 4-20 Text Matching Test Properties Dialog Box"

  6. Type tutortext1 as the test case name.

  7. Make sure the Pass when: option is set to Selected text is present.

  8. Click OK and view the test case in the Visual Script. Oracle Functional Testing for Web Applications adds the test case to the Visual Script under the Frame node.

    Figure 4-21 Text Matching Test Script Node

    Text Matching Test Script Node
    Description of "Figure 4-21 Text Matching Test Script Node"

Insert a Server Response Test Case

Server Response test cases measure the response time of a server access for a page in the Visual Script.

  1. Select the [2] Registration - Home Superstores, Inc. item in the Visual Script.

  2. Click the Insert Server Response test case button on the toolbar. Oracle Functional Testing for Web Applications opens the Insert Server Response Test Case dialog box.

    Figure 4-22 Server Response Test Properties Dialog Box

    Server Response Test properties dialog box.
    Description of "Figure 4-22 Server Response Test Properties Dialog Box"

  3. Type TutorTimer1 as the test case name.

  4. Set the Maximum Time Allowed for Playback option to 5 seconds. Leave the Minimum Time at 0 seconds.

  5. Click OK and view the test case in the Visual Script. Oracle Functional Testing for Web Applications adds the test case to the Visual Script between the Address and Frame nodes.

    Figure 4-23 Server Response Test Script Node

    Server Response Test Script Node.
    Description of "Figure 4-23 Server Response Test Script Node"

Insert a Form Element Test Case

Form Element test cases compare attributes and values of the elements in an HTML form.

  1. Select Current Script from the Options menu and then select Content Tests in the Functional Test section. Make sure the Forms and Form Elements check box are selected and click OK.

  2. Select the [2] Registration - Home Superstores, Inc. item in the Visual Script.

  3. Expand the page and select the TodaysDate element of the regres.htm form.

    Figure 4-24 Form Element Script Nodes

    Form Element script nodes.
    Description of "Figure 4-24 Form Element Script Nodes"

  4. Select Insert Form Element Test from the Tests menu. Oracle Functional Testing for Web Applications opens the Form Element Test dialog box.

    Figure 4-25 Form Element Test Properties Dialog Box

    Form Element test properties dialog box.
    Description of "Figure 4-25 Form Element Test Properties Dialog Box"

  5. Type TodaysDate as the test case name.

  6. Set the Select Property option to Value.

  7. Set the Select Test Criteria to Property Must Satisfy Expression.

  8. Change the Specify Expression field to Value = Date.

  9. Click the Test button. Oracle Functional Testing for Web Applications should return True in the Result field.

  10. Click OK and view the test case in the Visual Script. Oracle Functional Testing for Web Applications adds the test case to the Visual Script under the Form Element node.

    Figure 4-26 Form Element Test Script Node

    Form Element Test script node.
    Description of "Figure 4-26 Form Element Test Script Node"

Insert Table Test Test Case

Table test test cases let you define a custom test on a Web page table object. The Table Test Wizard lets you select the table object directly from the Web page by highlighting it with the mouse. The wizard also lets you specify the table object property to test and the type of test to perform.

  1. Select [1] Welcome - Home Superstores, Inc. in the Visual Script.

  2. Click the right mouse button and select Goto Page to open the Welcome - Home Superstores, Inc page in the Browser.

  3. Select Insert Table Test from the Tests menu. Oracle Functional Testing for Web Applications opens the Table Test Wizard.

    Figure 4-27 Table Test Wizard Welcome Dialog Box

    Table Test Wizard Welcome dialog box.
    Description of "Figure 4-27 Table Test Wizard Welcome Dialog Box"

  4. Type Depts as the test case name.

  5. Click Next. The Select Table Element dialog box is displayed.

    Figure 4-28 Select Table Element Dialog Box

    Select Table Element dialog box.
    Description of "Figure 4-28 Select Table Element Dialog Box"

  6. Moving the cursor over the web page highlights the tables on the page. Highlight the Departments area in the upper left-hand corner of the page.

    Figure 4-29 Table Element Selected Example

    Table Element Selected Example.
    Description of "Figure 4-29 Table Element Selected Example"

  7. Select the table. The path is displayed in the Select Table Element dialog box. Click Next to display the Create your tests dialog box.

    Figure 4-30 Create Table Test Dialog Box

    Create Table Test dialog box.
    Description of "Figure 4-30 Create Table Test Dialog Box"

  8. This dialog box displays the table in a spreadsheet format, showing the data that is in each table cell. The dialog box options change depending on the type of data in the cell. Cells that are checked will be tested. Select cell B2.

    Figure 4-31 Create Table Test Dialog Box with Field Selected

    Create Table Test dialog box with Field Selected.
    Description of "Figure 4-31 Create Table Test Dialog Box with Field Selected"

  9. Make sure that Exact is selected in the Matches the following field.

  10. Click Test to display the Last Played Table Tab. The result is displayed in the Result field.

  11. Click Finish and view the test case in the Visual Script. Oracle Functional Testing for Web Applications adds the test case to the Visual Script under the User Defined Tests node.

    Figure 4-32 Table Test Script Node

    Table Test script node.
    Description of "Figure 4-32 Table Test Script Node"

  12. Save the script as tutor2.

Example 6: Using the Data Bank Wizard on a Search Form

This example introduces the Data Bank Wizard and explains one way to use the Data Bank Wizard with the Text Matching test case to verify Search results pages. The Data Bank Wizard provides the capability to run iterative tests using data from a Data Bank file.

  1. Select New Script from the File menu to create a new Visual Script (save the previous script if prompted).

  2. Reload the c:\OracleATS\OFT\rswdemo\index.htm page in the Browser pane by selecting it from the Browser drop down list.

Recording a Search

  1. Click the Record button on the toolbar.

  2. Scroll the Browser pane and click the Go graphic next to Use SuperSearch.

  3. Enter Lamps in the Product Name field and click the Search button. Oracle Functional Testing for Web Applications records the search including the text you typed into the field.

  4. Click the Stop Record button on the toolbar.

Viewing the Parameters in the Visual Script

  1. Expand the [3] Results - Home Superstore, Inc page in the Visual Script. Notice the Search Parameter under the Address node of the tree.

    Figure 4-33 Parameters Script Node

    Parameters script node.
    Description of "Figure 4-33 Parameters Script Node"

Using the Data Bank Wizard to Map Variables

  1. Select Data Bank Wizard from the Edit menu.

    Oracle Functional Testing for Web Applications opens the Data Bank Wizard window with the parameters from the Visual Script in the Parameters list.

    Figure 4-34 Data Bank Wizard Variables Tab

    Data Bank Wizard Variables tab.
    Description of "Figure 4-34 Data Bank Wizard Variables Tab"

  2. Click the Add Variable button. The Data Bank Wizard opens a dialog box for specifying a variable name.

    Figure 4-35 Add Variable Dialog Box

    Add Variable dialog box.
    Description of "Figure 4-35 Add Variable Dialog Box"

  3. Type SuperSearch as the variable name, and then click OK.

    The Data Bank Wizard adds the name to the Variables list.

    Figure 4-36 Data Bank Wizard with a Variable Added

    Data Bank Wizard with a variable added.
    Description of "Figure 4-36 Data Bank Wizard with a Variable Added"

  4. Select the Search[3.1] item in the Parameters list, and then click Add Mapping. The Data Bank Wizard creates a mapping between the Search[3.1] parameter and the SuperSearch variable. You now need to bind the variable name to a field in a Data Bank file.

Using the Data Bank Wizard to Bind to a Data Bank

  1. Click the Data Binding tab. The Data Bank Wizard opens the Data Binding options with the variable name in the Variables list.

    Figure 4-37 Data Bank Wizard Data Binding Tab

    Data Bank Wizard Data Binding tab.
    Description of "Figure 4-37 Data Bank Wizard Data Binding Tab"

    Now we want to select the Data Bank file that contains the values we want to use for iterative testing.

  2. Click the Select button. The Data Bank Wizard opens a dialog box for selecting the Data Bank file.

    Figure 4-38 Select Data Bank Dialog Box

    Select Data Bank dialog box.
    Description of "Figure 4-38 Select Data Bank Dialog Box"

    Note:

    The .csv file name extension may or may not be visible depending upon your system settings.
  3. Select search.csv, and then click Open. The Data Bank Wizard adds the Field name from the Data Bank file.

    Figure 4-39 Data Bank Wizard with a Data Bank File

    Data Bank Wizard with a data bank file.
    Description of "Figure 4-39 Data Bank Wizard with a Data Bank File"

    Note:

    The Data Bank file is a comma-delimited ASCII file with the field names as column headers on the first line of the file. Subsequent lines of the file contain data. You can view the contents of any of the sample files in the c:\OracleATS\OFT\DataBank directory using Notepad or any other ASCII editor.
  4. Select the Search field in the Data Bank Fields list and then click the Add Binding button. The Data Bank Wizard adds the variable name to the Bindings list.

    Figure 4-40 Data Bank Wizard with Bindings

    Data Bank Wizard with bindings.
    Description of "Figure 4-40 Data Bank Wizard with Bindings"

  5. Click Fetch Record to cycle through the records in the external data file.

    Figure 4-41 Data Bank Wizard Fields and Records View.

    Data Bank Wizard fields and records view.
    Description of "Figure 4-41 Data Bank Wizard Fields and Records View."

  6. Continue clicking the Fetch Record button to cycle through all of the records in the file. There are five records in the sample Data Bank file.

  7. Click the OK button to close the Data Bank Wizard.

View the Data Bank Parameters in the Visual Script

  1. Examine the Parameters node under the Address node of the Visual Script tree.

    Figure 4-42 Data Bank Parameters Script Nodes

    Data Bank parameters script nodes.
    Description of "Figure 4-42 Data Bank Parameters Script Nodes"

    The Visual Script now includes the variable names as part of the Parameters. The check mark indicates that the parameter is mapped to a variable and bound to a field in a Data Bank file.

Insert a Text Matching Test Case

Now we want to insert a Text Matching text case that verifies that the search results were successful.

  1. Highlight the text "successfully found" in the search results page shown in the Browser pane.

  2. Click the Insert Text Matching test case button on the tool bar. Notice the text you highlighted is automatically captured by Oracle Functional Testing for Web Applications.

  3. Type VerifySearch as the case name, make sure Pass when: is set to Selected text is present, and then click OK.

  4. Select the HTML node in the Visual Script. Notice the yellow flag next to the HTML node. Oracle Functional Testing for Web Applications automatically turns off the HTML comparison test when you insert a Text Matching test.

    Since the search criteria will be different for each search during iterative play back, we know the HTML and product images on the page will be different from the recorded master each time. Instead of testing the HTML and images, the Text Matching test case will be used to verify a successful search.

  5. Save the Visual Script as tutor3.

Play Back the Script with Iterations

  1. Select Playback from the Run menu and then select Iterate. Oracle Functional Testing for Web Applications opens the Iterations dialog box.

    Figure 4-43 Iterations Dialog Box

    Iterations dialog box.
    Description of "Figure 4-43 Iterations Dialog Box"

  2. Select Playback with Data Bank and Use All Records.

  3. Click the OK button to playback the Visual Script.

  4. Watch as Oracle Functional Testing for Web Applications plays back the script several times using a different data value for the search each time.

Analyzing a Playback Failure

  1. Close the Results Report.

    Notice the Results log indicates that the search using the Furniture value (record 3) fails. We now need to analyze this failure.

  2. Select Data Bank Wizard from the Edit menu.

  3. Click the Goto Record button. The Data Bank Wizard opens a dialog box for entering the record number.

  4. Enter 3, and then click OK.

  5. Click OK to close the Data Bank Wizard.

  6. Click the Playback button on the toolbar to play back this one record.

  7. Scroll the Browser pane to view the Search Results page. Notice that the page indicates there is no product information for Furniture. Oracle Functional Testing for Web Applications was able to find this problem because the Text Matching test case you added to test for a successful search produced a failure.

  8. Make sure the [3] Results - Home Superstore, Inc page is still selected in the Visual Script.

  9. Click the right mouse button and select Discard Tested Page from the shortcut menu. The red circles are removed from the Visual Script. The Master version of the Visual Script is still the baseline to use for testing of the Web page.

Save the Script and the Results Log

  1. Save the Visual Script.

  2. Save the Output Log as tutor3.log.

  3. Select Clear Results Window from the View menu to clear the results log for the next test.

Example 7: Using the Data Bank Wizard on a Registration Form

This example explains how the Data Bank Wizard makes it easy to create automated data-driven tests. Data Banks are used to hold unlimited amounts of input data that can be fed automatically into your Web application.

  1. Select New Script from the File menu to create a new Visual Script.

  2. Reload the c:\OracleATS\OFT\rswdemo\index.htm page in the Browser pane by selecting it from the Browser drop-down list.

Recording Information in a Form

  1. Click the Record button on the toolbar.

  2. Scroll the Browser pane and click the Register link. The Registration page contains a form for entering Name, Email Address, and Phone number information.

  3. Enter your own information into the form and click the submit my entry button. The Results page returns showing the information you entered with a "successful registration" message.

Inserting a Text Matching Test Case

Now we want to insert a Text Matching text case that verifies that the Registration results were successful.

  1. Highlight the text "Your registration has been added" in the search results page.

  2. Click the Insert Text Matching test case button on the tool bar. Notice the text you highlighted is automatically captured by Oracle Functional Testing for Web Applications.

  3. Type VerifyRegistration as the test case name, make sure Pass when: is set to Selected text is present, and then click OK.

  4. Click the Stop Record button on the toolbar.

  5. Select Save Script As from the File menu and save the file as tutor4.

Viewing the Parameters in the Visual Script

  1. Expand the [3] Registered - Home Superstore, Inc page in the Visual Script. Notice the Parameters under the Address node of the tree.

    Figure 4-44 Parameters Script Nodes in the Script

    Parameters script nodes in the script.
    Description of "Figure 4-44 Parameters Script Nodes in the Script"

  2. Make sure the [3] Registered - Home Superstore, Inc page is selected in the Visual Script.

Using the Data Bank Wizard to Map Variables

  1. Select Data Bank Wizard from the Edit menu.

    Oracle Functional Testing for Web Applications opens the Data Bank Wizard window with all the parameters from the Visual Script in the Parameters list.

    Figure 4-45 Data Bank Wizard Variables Tab

    Data Bank Wizard variable tab.
    Description of "Figure 4-45 Data Bank Wizard Variables Tab"

  2. Click the Auto-Map button. The Data Bank Wizard automatically creates variable names and maps the variable names to the Parameter names.

    Figure 4-46 Data Bank Wizard with Auto-mapped Parameters

    Data Bank Wizard with auto-mapped parameters.
    Description of "Figure 4-46 Data Bank Wizard with Auto-mapped Parameters"

    You now need to bind the variable names to fields in a Data Bank file.

Using the Data Bank Wizard to Bind to Data Source

  1. Click the Auto Bind button. The Data Bank Wizard opens the Data Binding options with the variable names in the Variables list.

    Note:

    Auto Bind automatically creates a Data Bank file with field definitions and one record of data. It also automatically binds the fields to the variables created.

    Figure 4-47 Data Bank Wizard Data Binding Tab

    Data Bank Wizard Data Binding tab.
    Description of "Figure 4-47 Data Bank Wizard Data Binding Tab"

    Now we want to select the data source that contains the values we want to use for iterative testing.

  2. Click the Select button. The Data Bank Wizard opens a dialog box for selecting the Data Bank file.

    Figure 4-48 Select Data Bank Dialog Box

    Select Data Bank dialog box.
    Description of "Figure 4-48 Select Data Bank Dialog Box"

  3. Select customer.csv, and then click Open.

    The Data Bank Wizard automatically re-binds the appropriate data field names from the Data Bank file to the variable names.

    Figure 4-49 Data Bank Wizard with Bound Parameters

    Data Bank Wizard with bound parameters.
    Description of "Figure 4-49 Data Bank Wizard with Bound Parameters"

    Note:

    The Data Bank file is a comma-delimited ASCII file with the field names as column headers on the first line of the file. Subsequent lines of the file contain data. You can view the contents of any of the sample files in the c:\OracleATS\OFT\DataBank directory using Notepad or any other ASCII editor. The following illustration shows how Data Banks map to variables and Visual Scripts.

    Figure 4-50 How Scripts Map and Bind to Data Bank Records

    How Scripts Map and Bind to Data Bank Records.
    Description of "Figure 4-50 How Scripts Map and Bind to Data Bank Records"

  4. Click the Fetch Record button to cycle through the records in the Data Bank file.

    Figure 4-51 Data Bank Wizard Fields and Records View

    Data Bank Wizard fields and records view.
    Description of "Figure 4-51 Data Bank Wizard Fields and Records View"

  5. Continue clicking the Fetch Record button to cycle through all of the records in the Data Bank file.

  6. Click the OK button to close the Data Bank Wizard.

View the Data Bank Parameters in the Visual Script

  1. Examine the Parameters node under the Address node of the Visual Script tree.

    Figure 4-52 Script Nodes with Mapped and Bound Data Bank Variables

    Script nodes with mapped and bound Data Bank variables.
    Description of "Figure 4-52 Script Nodes with Mapped and Bound Data Bank Variables"

    The Visual Script now includes the variable names as part of the Parameters. The check marks indicate the parameters that are mapped to variables and bound to fields in a Data Bank file. The triangles indicate variables that are mapped, but not bound to fields in a Data Bank file.

  2. Save the Visual Script.

Play Back the Script with Data Iterations

  1. Select Current Script from the Options menu and then select Results Log, make sure the Failures Only radio button in the Results section is selected, and then click OK.

  2. Select Playback from the Run menu and then select Iterate. Oracle Functional Testing for Web Applications opens the Iterations dialog box.

    Figure 4-53 Iterations Dialog Box

    Iterations dialog box.
    Description of "Figure 4-53 Iterations Dialog Box"

  3. Select Playback with Data Bank and Use All Records.

  4. Click the OK button to play back the Visual Script.

  5. Watch as Oracle Functional Testing for Web Applications plays back the script several times using different data values for the registration.

Analyzing a Playback Failure

Notice that the Results log indicates a failure for Record 4 of the playback iteration. We now need to analyze this failure.

  1. Select Data Bank Wizard from the Edit menu.

  2. Click the Goto Record button. The Data Bank Wizard opens a dialog box for entering the record number.

  3. Enter 4, and then click OK.

  4. Click the OK button to close the Data Bank Wizard.

  5. Click the Playback button on the toolbar to play back this one record.

  6. Close Results Report.

    You can play back the current record repeatedly using Current Script from the Options menu, select the Playback section, and then select the Use Current Record option.

  7. Scroll the Browser pane to view the Registration Results page. Notice that the page indicates a server error. Oracle Functional Testing for Web Applications was able to find this error because the Text Matching test case you added to test for successful registration produced a failure.

  8. Make sure the [3] Results - Home Superstore, Inc page is still selected in the Visual Script.

  9. Click the right mouse button and select Discard Tested Page from the shortcut menu. The red circles are removed from the Visual Script. The Master version of the Visual Script is still the baseline to use for testing of the Web page.

Save the Script and the Results Log

  1. Save the Visual Script.

  2. Save the Output Log as tutor4.log.

  3. Select Clear Results Window from the View menu to clear the results log.

    This completes the Oracle Functional Testing for Web Applications tutorial.