Tips for recording functional tests
Following are some tips on ways around some potential recording issues.
Enabling 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. For this reason, leave the Record Monitor in view while recording. If you see this symptom, you need to run the enablers. For information, see topics Enabling Java Environments and Enabling Web Browsers.
Under certain conditions, you can start recording a script to test an application without having to prepare your test environment. The components involved in running the test application and recording the script are enabled automatically when you start recording. See Recording scripts without preparing the environment for more information.
Enabling and testing Eclipse shells and Eclipse RCP applications
HCL DevOps Test UI (Test UI) can be used to test Eclipse shell extensions. You must enable Eclipse, using the Eclipse Platforms tab of the Test UI 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. For this reason, leave the Recording Monitor in view while recording. 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 Test UI cannot be used to test an Eclipse in which it itself is running (one in which the Functional Test perspective has been loaded). If you have the Functional Test 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 Test UI 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, Test UI can dynamically enable these applications. During recording, you will notice a delay when you first use the mouse to click a control, 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 Test UI, Eclipse Integration 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 Test UI, Microsoft Visual Studio .NET Integration 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.
Changing 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.
Changing 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 Test UI 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 the tab with the script name. This makes it easier to edit the code. Double-click the tab again to restore Test UI to normal.