Unit Test Generation using XDoclet


XML & Web services: Unit Test Generation using XDoclet

  1. Unit Test Generation using XDoclet (2 messages)

    I'm not too keen on writing unit-testing classes by hand. Is there a tool that allows you to define a unit-test within a method's comments?

    Maybe an XDoclet extension that automatically creates JUnit test classes?

    This would not only make tests more convienient to write, but would also document useful method pre-/post-conditions within the method's comments/java-doc.

    Any interesting points-of-view would be appreciated.
  2. Stephen,

    JUnit tests help in the process of Test Driven Development. We write our test cases first, and those drive our implementation. This way we make our preconditions/postconditions know before implementing the class.

    By coupling the testcase in javadocs using either xdoclet or annotations (1.5) you are essentially writing the implementation first. This would break the strategy of TDD.

    If you are not using Test Driven Development then maybe documenting the testcase in your class would be ok. But still you are coupling your test conditions with your implementation and thats never good.

    -Anthony Bargnesi
  3. Hi Stephen, There are not such frameworks because it doesn't make any sense. I would say that it is much more likely to generate a code based on tests. Hopefully for us, there is no silver bullet. A agree with Anthony. Investigate Test Driven Development technique in more details to feel it :)