Inserting a log message into a functional test script

You can insert a log message into a functional test script and indicate whether it is a message, a warning, or an error. During playback, HCL DevOps Test UI (Test UI) inserts this information into the log.

About this task

To insert a log message into a functional test script:

Procedure

  1. If recording, click the Insert Script Support Commands button Insert Script Support Commands button on the Recording Monitor toolbar.

    If editing:

    • Position the pointer in the script where you want the log message.
    • Click the Insert Recording into Active Functional Test Script button Insert Recording into Active Functional Test Script button on the product toolbar.
    • Click the Insert Script Support Commands button Insert Script Support Commands button on the Recording Monitor toolbar.
  2. Click the Log Entry tab in the Script Support Functions dialog.
  3. In the Message to write to the log field, enter the message text.
  4. In the Result section, select either Information, Warning, or Error.
  5. Click Insert Code.

    Test UI inserts code in the script based on the option you selected in the Result section, where message is the text you entered:

    logInfo(" message")

    logWarning(" message")

    logError(" message")

    Note: You can pass image as an second argument to these methods. For example, when you want to get a screen capture along with an error message, you can use the second argument as shown in the following example:

    logError("error message here", getRootTestObject().getScreenSnapshot());

  6. Click Close to remove the Script Support Functions dialog from the screen.