• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

XDoclet and Junit

 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I know very little about XDoclet but someone told me it could be used to genarate the basic Junit test that you want to run on set and set method.
For example if i wanted to test a set and get method:

I could get Xdoclet to help me genarate a test method, just like to one below:


Could I actually genarate Junit if i had the correct XDoclet in my code. I undersand that it could not genarate all my test, but if it could just give me a templete it would be useful.
Thanks
Chris.
 
author
Posts: 396
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With XDoclet 1.2 (the current version), there is no JUnit module that comes out of the box. That's not to say that you couldn't write one for yourself (in fact, if you do and it proves to be useful, perhaps you could contribute it back to the project).
XDoclet 1.2 does, however, include a mockobjects module. Hands-down, this is one of my favorite XDoclet modules, because with just a single tag, you can generate hundreds (thousands?) of lines of mock object code.
In XDoclet 2, there is a JUnit plugin that has been started. I took a look at it just yesterday and it seems to be very much in a state of just-getting-started. Certainly not ready for primetime.
There's been a lot of talk by a lot of people about generating JUnit test cases using XDoclet. I even attempted to write one at one time. My thoughts (and I share these with a lot of other people) is that any test cases other than the very trivial test cases are probably too tough to generate and need to be hand-written. That said, I am looking forward to seeing someone prove me wrong. Therefore I challenge you (and anyone else) to write a JUnit module for XDoclet that generates test cases for trivial and non-trivial test cases.
 
Author
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Craig,
I need to buy your book.
I am a big XDoclet fan myself and have done quite a bit of writing about it for IBM developerWorks.


XDoclet 1.2 does, however, include a mockobjects module. Hands-down, this is one of my favorite XDoclet modules, because with just a single tag, you can generate hundreds (thousands?) of lines of mock object code.


Does your book cover the above?
 
Craig Walls
author
Posts: 396
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Rick Hightower:
Does your book cover the above? (mockobjects)


Yes it does. In fact, it's one of my favorite chapters because the example, while somewhat comical, is really fun.
When you get the book, let me know what you think.
 
Chris Harris
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Does XDoclet 2 support as much functionality as junitdoclet?
I was thinking of using junitdoclet but am worried that it will be redundant once XDoclet 2 is released.
Thanks
Chris.
 
Craig Walls
author
Posts: 396
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Chris Harris:
Does XDoclet 2 support as much functionality as junitdoclet?


Honestly, I know very little about junitdoclet and I've not given more than 2 minutes of a look at the XDoclet 2 JUnit plugin. However, I can tell with full certainty that the XDoclet plugin, as it stands today, is nowhere near being complete. I am very certain that junitdoclet is much more complete.
Of course, XDoclet 2 is still not final and its plugins can be released on a separate schedule than XDoclet itself. Therefore, there's lots of time for the JUnit plugin developer to flesh out his stuff. In the end it may end up being better than junitdoclet...or it may never be finished at all. At this point it's way too early to say for certain.
If you're that interested, perhaps you could pick up the JUnit stuff out of CVS and work on it yourself. Contribute your changes back to the project and maybe you'll even be allowed to be a committer. That's what's so wonderful about open-source...you don't have to wait to get the features you need.
 
author
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Chris Harris:
Hi,
Does XDoclet 2 support as much functionality as junitdoclet?
I was thinking of using junitdoclet but am worried that it will be redundant once XDoclet 2 is released.
Thanks
Chris.


JUnitDoclet just generates skeleton code for Junit tests - which is basically just a main method and empty methods for all methods in the class. I used it on my project and found that I only used it once. It's hardly maintained either - no updates in quite some time. It is kinda cool, but once you get an initial test (i.e. DAOTest or ActionTest), you can easily copy that as a template for new tests. At least, that's how I do it.
Matt
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!