• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Junit test case generation using ant

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic