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.
-
Unit Test Generation using XDoclet (2 messages)
- Posted by: Stephen Jelfs
- Posted on: April 19 2005 07:44 EDT
Threaded Messages (2)
- Effects on Test Driven Development by anthony bargnesi on April 19 2005 14:17 EDT
- Test should determine a code behaviour but not back to front by Pavel Sumarokov on December 27 2008 11:00 EST
-
Effects on Test Driven Development[ Go to top ]
- Posted by: anthony bargnesi
- Posted on: April 19 2005 14:17 EDT
- in response to Stephen Jelfs
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 -
Test should determine a code behaviour but not back to front[ Go to top ]
- Posted by: Pavel Sumarokov
- Posted on: December 27 2008 11:00 EST
- in response to anthony bargnesi
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 :)