Tips for recording functional tests

Following are some tips on ways around some potential recording issues.

Enable your JREs and Web browsers

You must enable your JREs for Java testing and your browsers for HTML testing. If your JREs or browsers are not enabled, the Recording Monitor is blank when you try to record against a Java or HTML application. We recommend leaving the Record Monitor in view while recording for this reason. If you see this symptom, you need to run the enablers. For information, see topics Enabling Java Environments and Enabling Web Browsers.

Enable and testing Eclipse shells and Eclipse RCP applications

Functional Tester can be used to test Eclipse shell extensions. You must enable Eclipse, using the Eclipse Platforms tab of the Functional Tester enabler. If your Eclipse shell is not enabled, you will be able to tell because the Recording Monitor will be blank when you try to record against it. We recommend leaving the Recording Monitor in view while recording for this reason. If you see this symptom, you need to run the enabler. See the Eclipse Platforms Tab topic for information about enabling an Eclipse-based application. Note that Functional Tester cannot be used to test an Eclipse in which it itself is running (one in which the Functional Tester perspective has been loaded). If you have the Functional Tester perspective loaded and you then close it, you will need to close and restart Eclipse itself before you can test.

You can test an instance of the Eclipse shell running from the same installation as Functional Tester as long as it uses a separate workspace. You can use the -data parameter to the eclipse.exe command line to specify the workspace. See the Eclipse documentation for details.

Dynamic enablement of Windows , and .Net applications

There is no enabler for Windows, and .Net applications. Instead, Functional Tester can dynamically enable these applications. During recording, you will notice a delay when you first use your mouse to click on or type keystrokes into one of these types of applications. During this delay the mouse will freeze. This delay is caused by the dynamic enablement.

Once an application is dynamically enabled, it stays enabled until it is closed.

If you use one of the object selection wizards (for example while recording a verification point) on an application before it is dynamically enabled, the objects in the application will not be highlighted. After the object is selected, the application will be dynamically enabled by the wizard. After it is dynamically enabled, the highlighting mechanism will work as usual.

Java script naming conventions

Scripts created in Functional Tester, Java Scripting must follow Java Class naming conventions. For example, script names cannot contain spaces or non-alphanumeric characters, nor can a script name begin with a number. While it is not mandatory to do so, it is traditional to begin a Java class name with a capital letter. Names of methods (such as verification point helper methods) have the same restrictions, but it is traditional to begin a Java method with a lower case letter. Finally, when a class or method name is made up of multiple words, it is traditional to capitalize the additional words. For example, you might use ApplicationMenuTest for a class name and validateFileMenu() for a method name.

VB.Net script naming conventions

Scripts created in Functional Tester, VB.Net Scripting must follow VB.Net Class naming conventions. For example, script names cannot contain spaces or non-alphanumeric characters, nor can a script name begin with a number. While it is not mandatory to do so, it is traditional to begin a VB.Net class name with a capital letter. Names of methods (such as verification point helper methods) have the same restrictions, but it is traditional to begin a VB.Net method with an upper case letter. Finally, when a class or method name is made up of multiple words, it is traditional to capitalize the additional words. For example, you might use ApplicationMenuTest for a class name and ValidateFileMenu() for a method name.

Change state of an application while recording verification points

When you have the recorder paused to create a verification point, be aware that if you change the state of the application in any way, it may affect your script. If you change the state of the application while the recorder is paused, actions recorded after this could prevent the script from playing back because the application is in the wrong state to play back the actions. Before you start to create the verification point, be sure to put the application in whatever state you need it to be in. For example, if you need to do actions in the user interface to locate the object you want to test, put the application in that state before you start the verification point.

Functional Tester offers an object selection method to access objects that may be difficult to select. In the Select an Object page of the Verification Point and Action Wizard, there is a delayed object selector you can use to pause the recorder while you access an object in the application. Actions done while the delay is in effect will not be recorded.

Change state of an application while recording a data-driven test

When you have the recorder paused to create a data-driven test, be aware that if you change the state of the application in any way, it may affect your script. If you change the state of the application while the recorder is paused, actions recorded after this could prevent the script from playing back because the application is in the wrong state to play back the actions. Before you start to create the verification point, be sure to put the application in whatever state you need it to be in. For example, if you need to do actions in the user interface to locate the object you want to test, put the application in that state before you start the verification point. You may find it is convenient to take advantage of the paused recorder to change the data contents of the controls you are going to data drive. This way, the recorder will not record redundant actions to set the data contents of the controls.

Selecting objects shortcut

Here's a neat shortcut. While recording, you can drag the Verification Point and Action Wizard button on the Record User Actions toolbar to immediately start selecting an object in your application. This is a shortcut for selecting it from the Select an Object Page of the Verification Point and Action Wizard. You will then be in the wizard after you select the object.

Recording scrolling actions

Scroll actions are commonly ignored in both Java and HTML recording. At playback, subitems are auto-scrolled into view before being acted upon, making the scroll actions rather irrelevant. In some cases Functional Test still records scroll actions when they are host-independent (in the case of JFC applications) to keep the recording as close as possible to the actual actions performed, though Functional Tester still auto-scrolls as necessary during playback to ensure that things work as expected.

Scroll actions will not cause failures during playback, since Functional Test auto-scrolls anyway and will ignore the normal out-of bounds and scrollbar-not-visible type of errors that can occur with scroll actions. Scroll actions tend to fail fairly commonly with cross-platform script execution, so ignoring scroll failures improves the cross-platform nature of scripts.

Hover feature

When you record actions in an HTML application, you can use this hover feature to move the mouse to a particular place during playback. This is particularly useful for clicking on menus or links in HTML testing. To use the feature, move the mouse pointer onto the object for which you want to record a hover. Press and then release the Shift key to record the hover. This will cause the recorder to insert a hover() method in the script. At playback, the mouse will then be able to activate links and menus by hovering on them, instead of clicking. You can use multiple hover actions to support a cascading menu. The Record Monitor will give you a warning message if you click where there is no object or if hover is not supported for an object.

Maximizing the script window

To maximize the script window (the Java Editor), double-click on the tab with the script name. This makes it easier to edit the code. Double-click again to restore Functional Tester to normal.

Related tasks

Recording a Java test script

Start your test applications

Recording in an existing script