Info task

Info task

In a nutshell

The Info task logs the value of an expression as a debugging statement during test execution. It helps testers inspect variable values, verify logic, and understand the flow of test execution as a script runs, all without affecting whether the test passes or fails.

1. Overview

The Info task accepts any expression during test execution, whether a literal value, a variable, or an expression built from constants, operators, or function calls. It displays the evaluated result in the test run's <log>, visible in real time as the test runs and afterward for review. This makes it useful at any point in a script where viewing the actual value helps understand what the script is working with, such as a retrieved text value, a count, or a computed result.

NotesNote: The Info task only logs the evaluated value. It does not alter the page's state, the script's flow, or the test's outcome.

2. Syntax

info(<message>);

ParameterData TypeDescription
message
The value to display. It can be a literal value, a variable, or an expression composed of constants, operators, and function calls that evaluates a value of any data type.

3. Examples

Example 1: Logging the result of an arithmetic expression directly

An expression doesn't need to be stored in a variable before it can be logged as Info can evaluate and log it directly.

// Log the result of adding two numbers using the Info task
info(2 + 3);
// output: 5

where:

2 + 3Expression evaluated and logged directly.

Combining a search term and its result count into one log line is easier to scan than logging each value separately.

// Create a <variable> 'searchTerm' to store the term entered into the search box
searchTerm = "Chrono 44";
// Create a <variable> 'resultCount' to store the number of results found for that search
resultCount = 3;
// Log a combined summary using the Info task
info("Search term: " + searchTerm + ", Results found: " + resultCount);
// output: Search term: Chrono 44, Results found: 3

where:

resultCountVariable storing the number of results found.
"Search term: " + searchTerm + ", Results found: " + resultCountExpression combining both values into one readable log line.

Example 3: Logging an expected total before using it in an assertion

Log a computed expected total before creating an assertion to confirm the exact value it should validate. The assertion then checks against a value the tester has already verified instead of one entered from assumption.

// Create a <variable> 'quantity' to store the number of units being ordered
quantity = 3;
// Create a <variable> 'unitPrice' to store the price of a single unit
unitPrice = 27500;
// Log the computed expected total using the Info task
info("Expected total: " + (quantity * unitPrice));
// output: Expected total: 82500

where:

unitPriceVariable storing the price of one unit.
"Expected total: " + (quantity * unitPrice)Expression computing and logging the expected total.

Example 4: Fetching a lease record's status field in a Lease Tracker application

Fetch and log a lease record's status field value in a Zoho Creator Lease Tracker application before using it elsewhere in the script. This confirms the exact value the script is working with.

// Open the Leases report in a Zoho Creator Lease Tracker application using the <Open URL> task
openURL("https://creatorapp.zoho.com/orgname/lease-tracker#Report:Leases", "same window");
// Click the lease record to open it in Detail View using the <Click> task
click(ui.leasetracker.lease-record-row);
// Fetch the lease status field's value using the <Get Text> task
leaseStatus = getText(ui.leasetracker.lease-status-field);
// Log the retrieved value using the Info task
info(leaseStatus);
// output: Active

where:

"https://creatorapp.zoho.com/orgname/lease-tracker#Report:Leases"Leases report URL.
"same window"Opens the report in the window already running the test.
ui.leasetracker.lease-record-rowLocator for the lease record row.
ui.leasetracker.lease-status-fieldLocator for the lease status field.
leaseStatusVariable storing the retrieved status text.

4. Use cases

Scenario 1: Confirming a product's exact displayed price format before writing an assertion

Before creating an assertion for a product's displayed price, a tester needs to verify the exact text rendered on the page. Even small formatting differences, such as currency symbols or thousand separators, can cause an assertion to fail despite the correct price being displayed.

A tester uses Zoho QEngine to fetch and store the displayed price in a variable, then logs it to the test run's log, so the exact value can be reviewed before creating the assertion.

Steps:

  1. Open the Diver Chronomat product page in the same window.
  2. Fetch and store the displayed price in a variable.
  3. Log the retrieved price for review.

Implementation

// Step 1: Open the Diver Chronomat product page on the ZWatch Commerce website in the same window using the <Open URL> task
openURL("https://zwatch.zohocommerce.com/products/diver-chronomat/3531661000000075722", "same window");
// Step 2: Fetch and store the displayed price in a variable using the <Get Text> task
productPrice = getText("[data-zs-selling-price]");
// Step 3: Log the retrieved price using the Info task
info(productPrice);

Scenario 2: Confirming a search results heading's text before asserting it

After searching for a product, a tester needs to know exactly what the results heading displays before asserting its exact text, since a subtle difference such as extra whitespace or a different search term echoed back could otherwise go unnoticed.

A tester uses Zoho QEngine to fetch and store the results heading's text in a variable, log it for review, and confirm that it matches the expected text.

Steps

  1. Open the home page in the same window.
  2. Search for a product.
  3. Wait for the results heading to become visible.
  4. Fetch and store the results heading's text in a variable.
  5. Log the retrieved heading.
  6. Confirm the results heading matches the expected text.

Implementation

// Step 1: Open the ZWatch Commerce home page in the same window using the Open URL task
openURL("https://zwatch.zohocommerce.com/", "same window");
// Step 2: Click the search icon to reveal the search input using the <Click> task
click(".theme-search");
// Step 3: Enter a search term using the <Set Value> task
setValue("[data-search-input]", "Chrono 44");
// Step 4: Submit the search using the <Send Keys> task
sendKeys("[data-search-input]", [keys.ENTER]);
// Step 5: <Wait> until the results heading becomes visible
wait(10, ".search-results-heading", event.SHOW);
// Step 6: Fetch and store the results heading's text in a variable using the <Get Text> task
resultsHeading = getText(".search-results-heading");
// Step 7: Log the retrieved heading using the Info task
info(resultsHeading);
// Step 8: Confirm the results heading matches the expected text using the <Assert Text> task
assertText(".search-results-heading", "Results for Chrono 44", errorhandling.STOP_ON_ERROR);

Scenario 3: Confirming a generated Application ID is captured correctly before reusing it

Consider a Zoho Creator Recruitment Portal application that generates a unique Application ID once a candidate's form is submitted. Before reusing that captured ID to locate the same record elsewhere, a tester confirms it was captured correctly right after submission.

A tester uses Zoho QEngine to fetch and store the generated Application ID in a variable immediately after submitting the form, then logs it to confirm the exact value before using it in a subsequent lookup step.

Steps

  1. Open the candidate application form in the Recruitment Portal application.
  2. Fill in and submit the application.
  3. Fetch and store the generated Application ID from the confirmation message.
  4. Log the captured Application ID.

Implementation

// Step 1: Open the candidate application form in a Zoho Creator Recruitment Portal application using the <Open URL> task
openURL("https://creatorapp.zoho.com/<orgname>/recruitment-portal#Form:New_Application", "same window");
// Step 2: Enter the candidate's first name using the <Set Value> task
setValue(ui.recruitmentportal.first-name-field, "Jordan");
// Step 3: Enter the candidate's last name using the <Set Value> task
setValue(ui.recruitmentportal.last-name-field, "Lee");
// Step 4: Submit the application using the <Click> task
click(ui.recruitmentportal.submit-button);
// Step 5: Fetch and store the generated Application ID in a <variable> using the <Get Text> task
applicationId = getText(ui.recruitmentportal.confirmation-application-id);
// Step 6: Log the captured Application ID using the Info task
info(applicationId);

5. Points to note

  1. Use the Info task to log a value for review during test execution. If the test's outcome needs to depend on that value, use an assertion task instead.
  2. The Info task accepts more than a plain value. <Constants>, <variables>, <operators>, and <function> calls can all be logged directly, without needing to store the result in a variable first.
  3. The Info task enforces a length limit of 10,000 characters.
  4. Review the test run log to see the values logged by the Info task.
  1. Get Text
  2. Get Attribute
  3. Get Count

Previous

Before using the Info task, ensure that you've learned how to measure an element's rendered height using the <Get Element Height> task.

7. What's next

Now that you've learned how to log a value using the Info task, learn how to accept or dismiss a browser alert using the <Handle Alert> task.