October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

How to Use TestNG Reporter Logs in Selenium

Use TestNG's Reporter.log from a Selenium test to add explanatory messages to generated HTML reports. Learn where to find them and how to diagnose missing output.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To add a message to a TestNG HTML report from a Selenium test, import org.testng.Reporter and call Reporter.log("message"); from the test flow. For example, log a useful milestone after opening a page or submitting a form. The message is report output—not an assertion, a browser setup step, or a replacement for application logging.

Write a Reporter message in a Selenium test

TestNG documents Reporter.log for messages that should appear in generated HTML reports. A minimal example is:

As an Amazon Associate I earn from qualifying purchases.

import org.testng.Reporter;
import org.testng.annotations.Test;

public class SearchTest {
  @Test
  public void searchShowsExpectedResults() {
    Reporter.log("Opened the search page");
    // Run the existing Selenium actions and assertions here.
    Reporter.log("Submitted the search and checked the results");
  }
}

This example assumes the project already has a working WebDriver setup and runs the method under TestNG. Reporter does not create or configure a browser. Add messages at meaningful points in the test flow, and use assertions to verify expected browser states: a log entry alone does not establish that a page or result was correct. TestNG’s documented example is Reporter.log("M3 WAS CALLED");. TestNG: Logging and results.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Keep messages useful and safe

  • Prefer concise milestones or outcomes, such as “Search form submitted” or “Results heading was visible.”
  • Do not log credentials, tokens, personal data, or other secrets; report files may be retained or shared.
  • Do not mistake Reporter messages for application logs or TestNG’s own internal logging.

Find the generated report

TestNG says the run’s index.html is in the output directory selected when launching SuiteRunner; it links to other HTML and text result files. Check the directory configured by the runner or build, then open the generated HTML report. The exact paths and layout can differ with Maven, Gradle, an IDE, or a custom reporter, so do not assume every setup writes to the same location. TestNG: Logging and results.

Choose the right TestNG output mechanism

Need Mechanism When to use it
Add explanatory text to a test’s generated HTML report Reporter.log(...) Use it for messages associated with the test flow.
React as tests start, pass, fail, or skip ITestListener TestNG describes listeners as real-time notifications of test events.
Build a report after all suites finish IReporter TestNG invokes generateReport(List<ISuite> suites, String outputDirectory) after the suites run.
Export structured TestNG-specific result details Built-in or custom XML reporting TestNG documents XML options including groups, result attributes, stack-trace output, and report fragmentation.

See the TestNG reporting documentation and TestNG listener interface index for the relevant APIs.

Troubleshoot missing messages

  • The test did not run under TestNG: confirm the test is being executed by the TestNG runner and that the method ran, rather than assuming the IDE or another test framework will collect its output.
  • You are checking the console only: Reporter messages are intended for generated HTML reports. Locate the actual output directory selected by the runner and inspect its HTML report.
  • The report is customized or replaced: report listeners and plugins can affect output layout. Check the project’s configured listeners and reporter settings instead of assuming the default file arrangement.
  • The project uses an unexpected TestNG dependency: check the version resolved by the build. The official download page lists TestNG 7.9.0 as current and was last updated 2026-08-31; your project may use another version. TestNG download page.

TestNG versions, logging, and third-party reports

TestNG’s logging documentation says that since version 7.5 it has used SLF4J as its logging facade and does not bundle an explicit SLF4J implementation by default. That concerns TestNG’s internal logging integration; it is separate from adding test messages with Reporter.log. Check the dependency resolved by your build before applying version-specific setup. Logging and results; Download.

ReportNG is a third-party HTML/XML reporting plugin described as a replacement for TestNG’s default HTML report. Its project page lists version 1.2.2 and says it was tested with TestNG 6.14.3; those details do not establish compatibility with every current TestNG or Selenium setup. The page outlines listener registration and an option to disable TestNG’s default listeners. Validate any plugin against the versions and runner in your own project. ReportNG project page.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

For a screenshot without writing or maintaining Selenium browser setup, ScreenshotNeo offers a one-call API. This is separate from TestNG Reporter output: it returns a screenshot or PDF rather than adding a message to a TestNG report. See the ScreenshotNeo API documentation.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots per month with no card, and paid plans start at $5 for 3,000. Learn about ScreenshotNeo, or sign up for 1,000 free screenshots a month with no card.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.