Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Junit test case generation using ant

 
mohit bahl
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

i am looking for reasonably good approach to auto-generate JUnit test cases for my business and dao layer classes. I need to doo this using an ant task.

Thanks in advance
mohit
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohit,
What are you trying to generate? Test stubs? Throwing bad input to make sure the code blows up?

Good tests require human involvement. An automatic test generator can't test your code is working as expected as it doesn't know what the code should do.
 
mohit bahl
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I absolutely agree with you about manual intervention in testing.

But my intentions are only to validate that the function calls are returning what they were suppose to and in case there is some code change done by some other developer then its impact can be known with the help of such test cases and can be caught at the time of an integrated build.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mohit bahl:
But my intentions are only to validate that the function calls are returning what they were suppose to

How do you know what they are supposed to return.



and in case there is some code change done by some other developer then its impact can be known with the help of such test cases and can be caught at the time of an integrated build.

This is what the tools claiming to generate tests do. They provide regression tests assuming the current implementation is correct. I haven't found an implementation that I like though. They tend to either not generate good coverage (focusing on throwing bad input values at the function) or are so brittle that they break for normal low level implementation changes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic