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...
Show off your group to the world. Share a photo of your group with us.

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 #17524 of 18121 |
Re: [agile-testing] Automated testing of logging feature

George wrote:
>
> If you've already got code that fetches a logger rather than having one
> injected, it's quite easy under Log4J to programmatically insert your
> own appender. The static getLogger() calls are just easy entry points
> into a very configurable system.

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 like:

Logger log = Logger.getLogger(MyClass.class);
log.info("Timeout waiting for database server: " + connection.getUrl());

You instead make an interface something like:

interface DatabaseLogger {
  void notifyConnectionTimeout(String url);
}

So then your production code reads nicer, and you centralize your log
messages in a few logging classes as opposed to having the message
Strings all over the application.


Six of one, half a dozen of the other, though. :-)  If you're testing
this stuff like it's a first-class citizen, you win either way.

Cheers,
Dan



Sat Jul 11, 2009 4:15 pm

etl_dan
Offline Offline
Send Email Send Email

Forward
Message #17524 of 18121 |
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