Skip to content

hablutzel1/GenerateTestCases

Repository files navigation

IMPORTANT: I don't maintain this project anymore (actually, from a long time ago). For a (not tested by me) fork, see https://github.com/Hazem-Ben-Khalfallah/test-cherry.

Generates Test Cases is  a port of Eclipse's generate test cases plugin described here:
http://wiki.openmrs.org/display/archive/Generate+Test+Case+Eclipse+Plugin

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:

import org.junit.Assert;
import org.junit.Test;

public class PersonTest {

	/**
	 * @see Person#sayHello()
	 * @verifies say hello, and nothing more that that
	 */
	@Test
	public void sayHello_shouldSayHelloAndNothingMoreThatThat() throws Exception {
		//TODO auto-generated
		Assert.fail("Not yet implemented");
	}
}

And then test your implementation code like this


    public void sayHello_shouldSayHelloAndNothingMoreThatThat() throws Exception {
        assertThat(intance.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.

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

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"));

Nothing more.


Instructions to compile it and run it in development stage
------------------------------------------------------------

By the time it is strongly coupled to Intellij Community Edition 9.0.3, and the folders that contains the plugin files need
to reside in the plugins/ folder in the D:\jaime\intellij\ideaIC-95.429

 Furthermore if you want to build and run ideaIC-95.429 you will need to place a jar generated for the plugin because of you have putted
 plugin's directory in the same directory that the idea project, and to the time I don't know how to let idea project to build the plugin
 for itself.

Another thing needed to run unit tests is to copy java\mockJDK residing in ideaIC-95.429\ to

C:\Documents and Settings\JHABLUTZEL\.IntelliJIdea90\system\plugins-sandbox\test

because when you run a unit test "C:\Documents and Settings\JHABLUTZEL\.IntelliJIdea90\system\plugins-sandbox\" is the home path
for the plugin.

About

Behaviour Driven Development plugin for IntelliJ IDEA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages