Search the web
Sign In
New User? Sign Up
agile-testing · Agile Software Testing
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Automated testing of logging feature   Message List  
Reply | Forward Message #17521 of 18129 |
Re: [agile-testing] Automated testing of logging feature

My favorite writeup on logging is from the soon-to-be-released book "Growing Object-Oriented Software, Guided by Tests" by Steve Freeman and Nat Pryce, the authors of the JMock tool.  They've published an early draft online so you can read it now:

http://www.mockobjects.com/book/listening-to-the-tests.html

See the section "Logging is a Feature"

The short answer is that most logging tends to be an afterthought rather than treated with the same care as the other business-requested features.  This typically means a proliferation of log statements scattered throughout the code.  If the logs we're talking about are used by the operations group for critical support, then it's important that those messages get unit tested.  The most common use of Log4j sprinkles static method calls to Logger.getLogger() throughout several classes and is hard to test.  Instead, Freeman and Pryce recommend treating logging as a service which gets injected into classes that need it, and unit tested that way.

Structuring the logging in this way will make it much easier to write unit or acceptance tests.

Dan


Sat Jul 11, 2009 1:29 am

etl_dan
Offline Offline
Send Email Send Email

Forward
Message #17521 of 18129 |
Expand Messages Author Sort by Date

Hello all, I'm working on an agile project and we have been writing acceptance tests for every story so far. We are using Log4J for logging, and so far the...
Tomas Pollak
tomas_pollak
Offline Send Email
Jul 10, 2009
2:17 pm

... Let me see if I understand correctly. Latent problems may exist in your software that are yet undetected and the customer wants these, as they happen, to...
Kaleb Pederson
kaleb_pederson
Offline Send Email
Jul 10, 2009
3:45 pm

Hmmm.... One option would be to assume Log4J handles the actually file writes, and then override it to redirect what it would write to a file, so it actually...
John Overbaugh
john.overbaugh@...
Send Email
Jul 10, 2009
3:45 pm

My favorite writeup on logging is from the soon-to-be-released book "Growing Object-Oriented Software, Guided by Tests" by Steve Freeman and Nat Pryce, the...
Daniel Wellman
etl_dan
Offline Send Email
Jul 11, 2009
1:29 am

... I whole-heartedly agree that logging should be a first-class user story. Too many apps fill up the log with trivia, yet don't contain the information...
George Dinwiddie
gdinwiddie
Offline Send Email
Jul 11, 2009
3:24 pm

... Agreed.  What I like most about Freeman & Pryce's approach is that they essentially make the logging service an interface, so instead of doing something...
Daniel Wellman
etl_dan
Offline Send Email
Jul 11, 2009
4:17 pm

Log4j already has lots of capabilities to write to a port (SocketAppender and SocketHubAppender). We've used this to write a general purpose functional test...
Bradley, Todd
todd404
Online Now Send Email
Jul 13, 2009
1:39 pm

see texttest (www.texttest.org, described in chapter 10 of my book), which is a full acceptance testing framework designed around analysing log entries. -- ...
Gojko Adzic
gojko_lastname
Offline Send Email
Jul 11, 2009
1:22 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help