Best Practices While Recording a Script Using Rational Functional Tester

Best Practices While Recording a Script Using Rational Functional Tester – RFT?

This article describes useful tips we can take advantage of, while recording in RFT

1) Best Practices of changing the State of Application while Recording:

a) Changing the State of Application while Recording Verification Point:

– When we pause the recorder for creating a verification point, we should bear it in mind that if we happen to make any change in the state of the application, it is going to affect our script.

– If we change the state of the application while the recorder is paused; all actions recorded after this event could prevent the script from playing back, since the application is in the incorrect state to play back the actions.

– Before beginning to create a verification point, we need to put the application in a state, which is ultimately desired. For example, if we need to do some actions in the user interface to locate the object desired to be tested, we need to put the application in that state before we start the verification point.

– In the “Select an Object page” of the Verification Point and Action Wizard, we can use the delayed object selector to pause the recorder while we access an object in the application. All actions performed while the delay is in effect will not be recorded.

b) Changing State of Application while Recording a Data-Driven Test:

– When we pause the recorder for creating a data-driven test, we should bear it in mind that if we happen to make any change in the state of the application, it is going to affect our script.

– If we change the state of the application while the recorder is paused; all actions recorded after this event could prevent the script from playing back, since the application is in the incorrect state to play back the actions.

– Before beginning to create a verification point, we need to put the application in a state, which is ultimately desired. For example, if we need to do some actions in the user interface to locate the object desired to be tested, we need to put the application in that state before we start the verification point.

– You can take the advantage of the paused recorder to change the data contents of the controls we are going to data drive. This way, the recorder will not record redundant actions to set the data contents of the controls.

2) Best Practices of Naming Conventions:

a) Java Script Naming Conventions

Scripts created in RFT – Java Scripting, must follow Java Class naming conventions. For example,

– Script names should not contain spaces or non-alphanumeric characters

– Script name should not begin with a number. As per a traditional practice, a Java class name is made to begin with a capital letter.

– As per a traditional practice, the names of Java methods are made to begin with a lower case letter.

– As per a traditional practice, we capitalize the additional words when a class or method name ismade up of multiple words. For example, we can use ApplicationMenuTest for a class name and validateFileMenu() for a method name.

b) VB.Net Script Naming Conventions

Scripts created in RFT – VB.Net Scripting, must follow VB.Net Class naming conventions. For example:

– Script names should not contain spaces or non-alphanumeric characters

– Script name should not begin with a number. As per a traditional practice, a VB.Net class name is made to begin with a capital letter.

– As per a traditional practice, the names of VB.Net methods like verification point helper methods are made to begin with an upper case letter.

– As per a traditional practice, we capitalize the additional words when a class or method name ismade up of multiple words. For example, we can use ApplicationMenuTest for a class name and ValidateFileMenu() for a method name.

3) Best practices while HTML recording:

– While recording actions in HTML applications, we should take the advantage of the hover feature to move the mouse to a particular place during playback. This is very useful for clicking on menus or links in HTML testing.

– To use the hover feature, we need to move the mouse pointer onto the object for which we 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.

– We can use multiple hover actions to support a cascading menu. The Record Monitor will give us a warning message if we click where there is no object or if hover is not supported for an object.