We take testing very seriously at Google. You may have seen our testing blog and how we even test on the toilet.

We also like to create automated tools to make our lives easier and in the testing world this can mean having code to watch your back.

We have released a new tool that we have been playing with, the Google Singleton Detector, as open source. Its job is to find singletons and global state in the Java code that we produce. But wait, why would I care to find out where singletons may be in my code? In some cases they can make testing difficult and hide problems with your design. There's a bit more to it than that, so check out the FAQ for more info.

Do you maintain Java code and need to keep it nice and clean? Give the singleton detector a try!

Many thanks to David Rubel and the team for creating this, and working to get it out into the open source world.

Post by Michelle Levesque, Google Software Engineer

Today we're unveiling the public release of "Testing on the Toilet": one of Google's little secrets that has helped us inspire our developers to write well-tested code. We regularly write flyers about everything from dependency injection to code coverage, and then plaster the bathrooms all over Google with each episode, almost 500 stalls worldwide.

We've decided to share this secret weapon with the rest of the world to spread our passion to other developers, and to provide a fun and easy way to educate yourself (and the rest of your company) about these important tricks and techniques.

We'll be posting episodes on the brand new Google Testing Blog on a regular basis and providing PDFs so you can print them out and put them up in your own bathrooms, hallways, kitchens, moon bases, secret underground fortresses, wherever. Send your photos and stories to and let us know how Testing on the Toilet is received at your company.

And meanwhile, keep writing those tests.