Compatible with: IntelliJ IDEA Android Studio
Jan 19, 2013
8 085

Plugin to generate unit test methods with meaningful names based in described behaviours with @should tags in interface methods javadoc

To see how to use it: or or for a usage video

Credits for the @should style testing should go to OpenMRS team

Recent change notes


  • Fixed to work with IntelliJ IDEA 12 (thanks to nribeka)


  • Added support for TestNG testing framework


  • Fixed @should descriptions renaming support for IntelliJ IDEA 11


  • Version number increased to update jar in Intellij plugins site


  • Fixed bug when custom source root has been configured# but not created yet


  • Added CTRL+Click functionality to jump to test cases

General usage instructions

Generates Test Cases is a port of Eclipse's generate test cases plugin described here:
You can see a 10 minutes video to grasp the concept in a really easy way here:

This project aims to make it easier to make TDD with a really cool and easy approach that consist in annotating interface method with desired behaviours like this:

public interface Person {

     * @return 
     * @should say hello, and nothing more that that
    String sayHello();


So with this plugin you could generate a test class for this interface like this one automatically:

public class PersonTest extends TestCase {
     * @verifies say hello, and nothing more that that
     * @see Person#sayHello()
    public void testSayHello_shouldSayHelloAndNothingMoreThatThat() throws Exception {
        //TODO auto-generated"Not yet implemented");

And then test your implementation code like this

  public void sayHello_shouldSayHelloAndNothingMoreThatThat() throws Exception {
        assertThat(instance.sayHello(), is("hello world"));

This way you can realize that for testing this behaviour you just wrote the should annotation in the sut (system under test) in a really descriptive way.

@should say hello, and nothing more that that 

Auto-generated the test class and test method (using the plugin) and then tested the actual expected behaviour with (hamcrest style junit test):

assertThat(intance.sayHello(), is("hello world")); 
Usage Instructions:

Open class in editor and press the "Generate Test Methods" button in toolbar to generate test methods for @should style annotations added to methods in javadoc