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 by Erik Hatcher on January 04, 2003 at 04:31 AM MST #
Posted by Matt Raible on January 04, 2003 at 04:52 AM MST #
Posted by Mathias Bogaert on January 04, 2003 at 10:04 AM MST #