# Test Recorder

The Test Recorder is a tool for recording user operations and verifications on applications and generating a test script from the recorded steps.

In this topic:

## Supported applications

The Test Recorder is supported for applications of the following technologies:

Technology | Windows | Linux/Mac
--- | --- | ---
Web |  |
Mobile (native, Web, and hybrid) |  |
SAPUI5 |  |
StdWin |  |
.NET Winforms |  |
.NET WPF |  |
Java |  |
PowerBuilder (from LeanFT 14.51) |  |

For recording on Web applications, the following browsers are supported:

Chrome, Firefox, Internet Explorer, and Safari (on Mac).

Back to top

## Test Recorder benefits

The Test Recorder is a useful tool for accelerating test creation and can be beneficial for:

- Creating the main body of a test, which you can later add to and refine manually.

- Learning how to write tests gradually, assisting in your learning curve.
- Quickly adding steps to an existing test.

Back to top

## Prerequisites

- For recording on Web, make sure that your browser is set up with the LeanFT extension. For details, see Set up web browsers and controls.

- Make sure that the LeanFT runtime engine is configured to use the add-in for the technology on which you want to record. For details, see Customize LeanFT runtime engine settings.

- If you want to record on a mobile device connected to Mobile Center, make sure to configure the connection to Mobile Center as described in Connect LeanFT and Mobile Center.

Back to top

## Record GUI operations using the Test Recorder

You can record on several browsers and mobile devices at a time. You can also record on multiple desktop applications in a single recording session.

If you are recording on a mobile device, open the mobile device in Mobile Center, as described in Select the device and application.

To record GUI operations and add verifications:

1. In your IDE, open an existing test or create a new one.

2. Run the Test Recorder.

   - From your IDE menu:

     Click LeanFT > Test Recorder or click the Test Recorder button.

     The IDE is minimized and the LeanFT Recorder toolbar appears at the top of the screen.

   - In standalone mode:

     Windows | From the Start menu, open Micro Focus > LeanFT > Test Recorder.
     Linux/Mac | Open the Tools folder from the LeanFT installation folder, and then run ./recorder-leanft.

   The Test Recorder does not start recording as soon as you open it. Bring your application to the desired state before you start recording.

   Tip: To record on a Web browser, you must use a browser window that was opened after the LeanFT runtime engine started. For details, see Start/Stop the runtime engine.

3. On the LeanFT Recorder toolbar, click the Start recording button.

4. Perform operations on your application. Each operation that you perform is recorded and a description for that operation is displayed as a step in the toolbar.

   Note: When recording on a packaged mobile application, you can perform operations manually on the physical device, or using the remote access window. To record on a non-packaged application, you must perform the operations using a remote access window.

5. At any point during the recording session, you can do the following:

   Review the recorded steps

   In the LeanFT Recorder toolbar, click the Maximize button to display the steps.

   Add comments

   Add comments to the recorded steps. The comment will be added to the code after you generate it. You can also add comments to the code after you complete the recording session.

   How to add a comment:

   - To add a comment to the last recorded step, click the step's comment button to view the comment area, and replace the `Enter comment` placeholder with your comment.
   - To add a comment to other steps, maximize the Test Recorder to display the steps. Enter your comment to replace the `Enter comment` placeholder, visible when you hover over the step.
   Add verifications

   Add verification steps, which will be included in the code that you generate from the session.

   In the LeanFT Recorder toolbar, click the Add verification button. Click an object whose state or behavior you want to verify. In the verification designer that opens, specify the properties to verify and the conditions they must meet. For details, see Add verification steps during a recording session.

   Edit verifications

   Edit a verification step added in this recording session, to change its name or the properties and values that it checks.

   Maximize the Test Recorder to display the steps, hover over the verification that you want to modify and click the Edit button. In the verification designer that opens, modify as needed and click UPDATE.

   Pause/Resume recording

   Pause the recording session if you want to perform an operation that you do not want to record. For example, closing a pop-up dialog box that is not part of the test flow.

   In the LeanFT Recorder toolbar, click the Pause button. To resume the session, click the Resume button and continue recording.

   Delete a step.

   Maximize the Test Recorder to display the steps, hover over the step you want to delete, and then click the Delete button.

   Close

   Close the recording session . Click X to close the session without generating code.

6. When you are done recording, click the Stop button. The recording session ends.

7. When the recording session ends, you can do the following:

   - Review the steps you recorded, delete unnecessary steps, and add comments.
   - Resume the recording session and add steps or verifications. Click the Resume button.
   - Redo the recording, discard the current session and begin a new recording. Click the Start new recording button.

8. Click the Generate code and copy to clipboard button.

   The default language in Eclipse, Spring Tool Suite, JBoss Developer Studio, IntelliJ IDEA, and Android Studio is Java. In Visual Studio, the default language is C#. However, you can change the setting to any language supported on your IDE.

   To change language, click the Settings button and select a language. The selection is saved and used for all subsequent code generations.

9. Use the Export steps to CSV file button to export the recorded steps' descriptions. This provides a manual-test version of the recorded steps.

10. Paste the script into your test. You can then make any necessary changes, such as synchronizing your test with the application by adding WaitUntil calls.

    Use the various WaitUntil methods from the LeanFT SDKs to wait for an object in the application to meet a specific condition before performing the next test step. You can wait for the object to exist, become enabled or visible, or any other relevant condition.

    For details on these methods, see the .NET, Java, and JavaScript SDK references.

Back to top

## Add verification steps during a recording session

During a recording session, you can add verification steps, which will be included in the code that you generate from the session.

To add a verification step:

1. In the LeanFT Recorder toolbar, click the Add verification button.

2. Click an object whose values you want to verify. The verification designer opens, displaying the object's properties and current values, as well as the object hierarchy.

   The most commonly verified properties are located at the top of the dialog box, for your convenience.

3. To change the name of the verification step, replace the Verification Name placeholder at the top. When the test runs, this name is used in the report.

4. Select the properties to verify and the conditions they must meet.

   Note: You can select a different object from the hierarchy. The verification step checks the properties of the selected object only.

   To edit the property value in a condition, click the value.

   To edit the operator in a condition, click the operator and select one of the following operators:

   = | Equal. To pass the verification, the value in the application must be equal to the specified value.
   | Not Equal. To pass the verification, the value in the application must not be equal to the specified value.
   abc* | Starts with. To pass the verification, the string's value in the application must start with the specified string.
   *abc | Ends with. To pass the verification, the string's value in the application must end with the specified string.
   *abc* | Contains. To pass the verification, the string's value in the application must contain the specified string.
   .* | Match. To pass the verification, the string's value in the application must match the specified regular expression.

5. Click ADD to add the verification step to the steps you recorded.

Back to top

## Code generation

The Test Recorder is available on all IDEs supported by LeanFT. You can choose to generate the code in either Java, JavaScript, or C#.

The script created is self-contained and includes all the object identifications required using descriptive programming. It also includes any comments added to document the operations performed during your recording session.

The code is based on the LeanFT SDK and, typically, has the following format:

Test step:

    var testObject = browser.describe(<ObjectIdentification>);
    testObject.<Operation>(<Parameters>)

Verification:

    WebElement testObject = browser.describe(<ObjectIdentification>);
    com.hp.lft.report.Reporter.startReportingContext(<VerificationSectionName>, com.hp.lft.report.ReportContextInfo.verificationMode());
        Verify.areEqual(<Value>, testObject.<Property>(), "Verification", "Verify property: <propertyName>");
        Verify.contains(<Value>, testObject.get<Property>(), "Verification", "Verify property: <propertyName>");
    com.hp.lft.report.Reporter.endReportingContext();

The object identification code is based on the definitions configured in the LeanFT engine object identification settings. You can configure the default settings. Any change that you make affects how objects are identified in both the Object Identification Center and in the Test Recorder generated code. For more details, see Customize how to identify objects.

Note: For native mobile objects in hybrid application, the code generated includes the fully qualified namespace of the mobile SDK test objects (for Java and C#). This helps differentiate between mobile and Web objects.

Back to top

See also:

- Verifications

https://admhelp.microfocus.com LeanFT 8942
Tips to improve your search results...TOC Lean Functional Testing Help Center LeanFT Help Center 14.50 - 14.53 All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic Version:(Undefined variable: _rscC_Basic_Variables.FloatingTocShow)