Skip to content

Reporting in UI-licious Tests

UI-licious automatically generates a test report as your script runs. The report is made up of step-by-step logs, and you can also add your own messages and assertions to make the report easier to read and debug.

What UI-licious logs automatically

Every UI-licious command you run (for example I.click(), I.fill(), I.see(), etc.) is captured as a log entry in the test report.

Each log entry includes:

  • a pass or fail status
  • a screenshot captured at that step
  • error details if the command fails (so you can see what went wrong)

If a command fails, it is logged with a failure status and includes error details to help diagnose the issue.

Adding your own log messages

Sometimes the automatic step logs are not enough — especially when you want to label a section of the flow, or print out computed values.

UI-licious provides the following APIs for custom logging:

  • TEST.log.info() – Log an informational message
  • TEST.log.pass() – Log a message with a success status
  • TEST.log.fail() – Log a message with a failure status and fail the test
  • TEST.assert() – Validate a condition and log a success or failure

Logging informational messages

Use TEST.log.info to add notes to your report without affecting pass/fail status. This is commonly used to describe what a block of steps is doing:

js
TEST.log.info("Starting checkout flow")
// ... steps ...

Or print out values for debugging:

js
var orderId = I.getText("span[data-test-id='orderId']")
TEST.log.info("Order ID: " + orderId)

Logging custom validation results

Use TEST.log.pass to log a message with a success status, and TEST.log.fail to log a message with a failure status (which will result in the test failing). These are commonly used when you need custom validation logic that cannot be expressed using built-in assertions.

js
I.click("Generate report")

var totalAmount = Number.parseInt(I.getText("span[data-test-id='total-amount']"))
if(totalAmount > 0){
  TEST.log.pass("Total amount is a valid.")
} else {
  TEST.log.fail("Total amount is invalid: amount cannot be negative.")
}

You can also use TEST.assert instead of an if-else block to log a success or failure message depending on a condition. The example above can be rewritten as such:

js
I.click("Generate report")

var totalAmount = Number.parseInt(I.getText("span[data-test-id='total-amount']"))
TEST.assert(
  totalAmount > 0, 
  "Total amount is a valid.", // log message
  "Total amount is invalid: amount cannot be negative." // error details
)

Using a combination of automatic step logs, custom log messages, and assertions helps produce reports that are easy to understand, debug, and share with your team.