JUnit plugin

Hello,

I'm wondering if someone can offer some help on configuring the "JUnit
Test Plugin" described at

http://www.intellij.org/twiki/bin/view/Main/JUnitTestPlugin

Despite the fact that the URL offers some documentation, it is not
obvious to me how to configure/setup the plugin.

For example, my test code is in a mirror image directory:

source/com/myorg/...

test/com/myorg/...

How do I tell the plugin where the root of the test directory is? Note
that IntelliJ already has this information in the Project Settings |
Project | Paths tab where both 'Sources' and 'Test Sources' are defined.

Also, I'm not sure how to define the $CLASS$ and $DIRECTORY$ variables.

Any help would be welcome,

Thank you,

Ted

7 comments
Comment actions Permalink

Hi Ted,

You don't need to define the variables. The plugin does that for you. They are just placeholder to match the real values.

Also IDEA src/test organization is not enough to define the exact mapping. The plugin supports a lot of mappings. Consider yourself lucky if you have a straight parallel hierarchy. On most of my legacy projects, I am not so lucky ;)

I have beefed up the setup documentation. Please take a look and see if they make more sense:
http://www.intellij.org/twiki/bin/view/Main/JUnitTestPluginUserGuide

Thanks again

Jacques

0
Comment actions Permalink

Thank you Jacques,

I'll look at the updated documentation,

Thanks again,

Ted



Jacques Morel wrote:

Hi Ted,

You don't need to define the variables. The plugin does that for you. They are just placeholder to match the real values.

Also IDEA src/test organization is not enough to define the exact mapping. The plugin supports a lot of mappings. Consider yourself lucky if you have a straight parallel hierarchy. On most of my legacy projects, I am not so lucky ;)

I have beefed up the setup documentation. Please take a look and see if they make more sense:
http://www.intellij.org/twiki/bin/view/Main/JUnitTestPluginUserGuide

Thanks again

Jacques

0
Comment actions Permalink

Hi Ted,

I really don't mean to hijack this thread, but have you tried the TestDox plugin for IDEA?

http://www.intellij.org/twiki/bin/view/Main/TestDoxPlugin

It's particularly helpful if you'd rather name your test methods to describe what tested classes are and are not supposed to do.

Regards,

Franck

0
Comment actions Permalink

Frank,

Please don't mention that "you *really * don't mean to hijack this thread" when you are exactly doing that. This is a free forum so there is nothing that say that you cannot "sell" your plugin anywhere. At the very least, be honest about it.

The TestDox plugin is a great plugin that is really useful (I use it myself) and you certainly are very commited to improving it (btw when you update the download count on your page http://www.intellij.org/twiki/bin/view/Main/TestDoxPlugin, please save it as a minor edit. Right now, anybody that has notification turned on gets spammed every time you get 50 additional downloads!).

Jacques

0
Comment actions Permalink

Jacques,

Ok, fair point, it's just that I particularly didn't want to cross you as a fellow plugin author, that's all.

As for the download count, it's kind of you to mention the notification which I didn't know about.

Regards,

Franck

0
Comment actions Permalink

Ted,

To some extent, this is supported too in the JUnitTestPlugin: test method names can be converted into english sentence in the test method navigation popup.

So now which plugin should you use?

You can certainly do like me and use both plugins. They unfortunately overlap a lot but both have unique features that are useful:

  • TestDox gives you a tool window that shows all test methods converted into english sentences: testPopEmptyStackThrowException() would show as "Pop empty stack throw exception". You can create/rename/delete tests through it using sentences. The plugin will manage the test methods accordingly. Neat!

  • JUnitTestPlugin gives you a primitive method coverage feedback (little editor gutter icons for methods w/o any associated tests) and more powerful test method management/creation.



Philosophically speaking they differ slightly:
TestDox assumes that you are testing behaviors of a class not methods. It doesn't provide any support for "method" testing. However it is great to look at a test class as the specification of the behaviors of the associated tested class. If you are careful about not revealing private parts of a class, you are most likely doing that already since you will test groups of methods that together form an observable behavior (cannot test Stack.pop() independently of Stack.push()).

JUnitTestPlugin does not provide anything special for that. It only has the same navigation/refactoring support. However if you want to manage the tests at the method level, the JUnitTestPlugin provides additional management features like automatic test method refactoring (on method rename), untested highlighting, templatized creation, filtered navigation...

I hope this helps a little.

Jacques

0
Comment actions Permalink

Jacques, this is the best description I've seen (of the two test plugins
but also of their approaches and consequences).

Thanks a lot
r.

Jacques Morel wrote:

Ted,

To some extent, this is supported too in the JUnitTestPlugin: test method
names can be converted into english sentence in the test method navigation
popup.

So now which plugin should you use?

You can certainly do like me and use both plugins. They unfortunately overlap
a lot but both have unique features that are useful: * TestDox gives you a
tool window that shows all test methods converted into english sentences:
testPopEmptyStackThrowException() would show as "Pop empty stack throw
exception". You can create/rename/delete tests through it using sentences.
The plugin will manage the test methods accordingly. Neat! * JUnitTestPlugin
gives you a primitive method coverage feedback (little editor gutter icons
for methods w/o any associated tests) and more powerful test method
management/creation.


Philosophically speaking they differ slightly: TestDox assumes that you are
testing behaviors of a class not methods. It doesn't provide
any support for "method" testing. However it is great to look at a test class
as the specification of the behaviors of the associated tested class. If you
are careful about not revealing private parts of a class, you are most likely
doing that already since you will test groups of methods that together form
an observable behavior (cannot test Stack.pop() independently of
Stack.push()).

JUnitTestPlugin does not provide anything special for that. It only has the
same navigation/refactoring support. However if you want to manage the tests
at the method level, the JUnitTestPlugin provides additional management
features like automatic test method refactoring (on method rename), untested
highlighting, templatized creation, filtered navigation...

I hope this helps a little.

Jacques

0

Please sign in to leave a comment.