Refactor method name and test method name in the same time

I have search for a while, the way to refactor a method and to automatically rename the test method. e.g : i've got a method call execute(), and the test method called executeShouldReallyDoTheJob() if it is in a JUnit 4.0 style or testExecuteShouldReallyDoTheJob() in a JUnit 3.8 style.

When i rename execute() to doIt() the test method still remain executeShouldReallyDoTheJob(). i would like to have the test method to be renamed to doItShouldReallyDoTheJob / testDoItShouldReallyDoTheJob().

There is an eclipse plugin that can do this (and more) for you : moreunit  ; but it can do a lot of other interesting things like automatically move the test class when you move a class :

suppose that I've got a class named MyClass in src/main/java/com/gisgraphy/package and the test class MyClassTest in gisgraphy/src/test/java/com/gisgraphy/package and i move MyClass to src/main/java/com/gisgraphy/other/package with the Eclipse refactor tool, the test class MyClassTest will be automatically moved to src/test/java/com/gisgraphy/other/package. when you'll read the documentation, i'm pretty sure you'll install and use it !

Enjoy :)

David

La discussion continue ailleurs

URL de rétrolien : https://davidmasclet.gisgraphy.com/index.php?trackback/17

Fil des commentaires de ce billet