Friday January 03, 2003
JUnit Tests - Naming Conventions
I am using Interfaces in my persistence layer, as well as for my Business Delegates. These interfaces are named things like UserDAO and UserManager. Their implementations are UserDAOHibernate and UserManagerImpl. First off, I don't know that I need interfaces for my business delegates, but they're already in place, so I'm going with it.
What I'm wonder is if my JUnit TestCases should reflect the Interface name, or the implementation name? UserDAOTest.java or UserDAOHibernateTest.java. I like the first one better, but I tend to hard-code information in it so I can call UserDAOHibernate.java - like the daoType to use. I started out using UserDAOTest because I thought it made more sense - and then it could be used to test all implementations.
Lately, I've been using JUnitDoclet to generate my TestCase skeletons, and it only generates TestCases for concrete classes, not interfaces. Therefore, I've changed to using UserDAOHibernateTest, which can be a helluva lot to type (and remember) when running TestCases! Here's the Ant command I use to run this test:
ant test-ejb -Dtestcase=UserDAOHibernateTest
And User is a short word! Can you imagine what these suckers will look like when I have an object such as ChangeRequest. Ughh. What do you gents think - I'm all ears.
Posted in Java
at Jan 03 2003, 04:02:14 PM MST
3 Comments
Search This Site
Recent Entries
- Wine Tasting in Napa Valley
- How to build a Shot-Ski
- Bus Project Update
- Farewell to the 2011-2012 Ski Season
- Cruising around the Western Caribbean
- Spring Break!
- A Spectacular Trip to Stockholm and Madrid
- Comparing Web Frameworks and HTML5 with Play Scala at Jfokus 2012
- Play Framework 2.0 with Peter Hilton at Jfokus
- Secure JSON Services with Play Scala and SecureSocial
Posted by Erik Hatcher on January 03, 2003 at 10:31 PM MST #
Posted by Matt Raible on January 03, 2003 at 10:52 PM MST #
Posted by Mathias Bogaert on January 04, 2003 at 04:04 AM MST #