permaculture playing cards
The moose likes Agile and Other Processes and the fly likes Has anyone done EJB heavy projects in TDD fashion ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Agile and Other Processes
Bookmark "Has anyone done EJB heavy projects in TDD fashion ?" Watch "Has anyone done EJB heavy projects in TDD fashion ?" New topic

Has anyone done EJB heavy projects in TDD fashion ?

Gavin Bong
Ranch Hand

Joined: Apr 25, 2003
Posts: 56
My next project will be using EJB CMP for persistence. Does anyone have tips to share on how they did TDD with EJB components ? Is xdoclet sufficient ?
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
Isn't this a question of whether to test generated code or not, or to what degree to test it?
I would probably not write tests for the CMPs themselves -- I'd trust that the appserver implements the spec correctly. Then again, I'm not practicing TDD at the moment.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Matthew X. Brown
Ranch Hand

Joined: Nov 08, 2000
Posts: 165
I developed CMP Beans on WAS 3.5 using TDD- it was kinda silly- because so much of the code is generated for you(just like in Xdoclet)- by Visual Age/WSAD. Its a little different doing point and click type development with TDD- maybe with the exception of custom finders(which you need to hand code). However, the Junit tests that were derived as a result were valuable-I could change the CMP- then tweak the Junit class and run it- and know that my code was solid. I guess that is true wherever Junit is used....
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
I always get a little worried when I see statements like "my next project will use X technology, how do I use test-driven development with it?" I can't help feeling that the person asking the question has missed the point of test-driven development a bit.
In test-driven development you let the tests guide you toward the correct technology. Every time you make a decision before writing any tests, you are constraining what you can learn from your tests. It might be that your project doesn't actually need EJB CMP, but can be done in a much simpler and easier way.
Can you describe a little more about what your project is intended to do - what benefits should it give to customers or users ?
Once you have some stories about what it needs to do, then you can start writing tests, and then you can start writing code to make those tests pass.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
I agree. Here's the link:
subject: Has anyone done EJB heavy projects in TDD fashion ?
It's not a secret anymore!