Accepted answer

you can use my plug-in to create tests easily:

  1. highlight the method
  2. press ctrl+alt+shift+u
  3. it will create the unit test for it.

the plug-in is available here. hope this helps.


any unit test you could create by just pressing a button would not be worth anything. how is the tool to know what parameters to pass your method and what to expect back? unless i'm misunderstanding your expectations.

close to that is something like fitnesse, where you can set up tests, then separately you set up a wiki page with your test data, and it runs the tests with that data, publishing the results as red/greens.

if you would be happy to make test writing much faster, i would suggest mockito, a mocking framework that lets you very easily mock the classes around the one you're testing, so there's less setup/teardown, and you know you're really testing that one class instead of a dependent of it.


check out this discussion [how to automatically generate junits?]

if you are starting new and its a java application then spring roo looks very interesting too!

hope that helps.


to create a test case template:

"new" -> "junit test case" -> select "class under test" -> select "available methods". i think the wizard is quite easy for you.

Related Query