Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8894963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:38:48+00:00 2026-06-14T23:38:48+00:00

What is best practice for printing log statements from a PHPUnit test case? I

  • 0

What is best practice for printing log statements from a PHPUnit test case?

I am running selenium test cases and want to print out something like “Log in acccomplished”, “Page XY opened”.

I want to see those in any log file I want. Would be good, if you can define a log level.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:38:50+00:00Added an answer on June 14, 2026 at 11:38 pm

    I would suggest that You use the Selenium Server Logging. It will provide You with all debugging information You might need.

    If it’s not an option for You and You still want to log from the PHPUnit test cases, You have 3 options:

    1. Use the built-in logging functionality (documentation), which can be configured through either phpunit.xml file or the command line arguments (documentation);
    2. Create Your own logger by implementing the PHPUnit_Framework_TestListener interface, which is kind of limited because it supports only a limited amount of events You can log, such as startTest, endTest, addError, addFailure, etc. See the (documentation) for the complete list of the supported events. You could possibly add some more events to your implementation but that would also require that You override the PHPUnit_Framework_TestSuite::run() method by subclassing the PHPUnit_Extensions_TestDecorator class (documentation) or by implementing the PHPUnit_Framework_Test interface (documentation).
    3. The easiest and more flexible option is to subclass the PHPUnit_Framework_TestCase class and implement the logging functionality there. This will allow You to log from within Your test methods.(documentation)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of a best practice print document for printing a website in
What is the best practice to accessing a single running mnesia node from another
What is the best practice for generating valid XML with PHP from user submitted
I am looking for best practices in regards to printing from a WinForms application.
I ask this partly because I want to know the best practice way of
When printing to PDF using C# + Excel Interop what is the best practice
Best practice is to use unique ivs, but what is unique? Is it unique
Short best practice question: If an object A is injected into another object B,
The 'best practice' (as I see it) to atomically create a new file, is
The best practice seems to be to use assert for a condition that should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.