JUnit integration tries to run all tests in all modules

This http://jetbrains.net/jira/browse/IDEADEV-2614 is marked as a feature request that will is planned for the next version (not 6.0). I think it's a bug. When I right-click on a path and select 'Run "All Tests"' I want to run all tests below that source path and not all tests in all modules.

The current behavior - to run all tests in all modules instead of the ones in the selected path - is totally unintuitive and a backward step compared to earlier versions of IDEA.

The feature that allows to create a run configuration for all tests in all modules is great, but it shouldn't make IDEA as unintuitive as it does right now.

Now I have to create an "All Tests" run configuration for each project to be able to run tests for specific modules.

Cheers,
Robert

14 comments
Comment actions Permalink

Hello Robert,

RB> This http://jetbrains.net/jira/browse/IDEADEV-2614 is marked as a
RB> feature request that will is planned for the next version (not 6.0).
RB> I think it's a bug. When I right-click on a path and select 'Run
RB> "All Tests"' I want to run all tests below that source path and not
RB> all tests in all modules.
RB>
RB> The current behavior - to run all tests in all modules instead of
RB> the ones in the selected path - is totally unintuitive and a
RB> backward step compared to earlier versions of IDEA.

Are you really sure about the "earlier versions" part? I didn't check, but
I think the JUnit runner in 5.x also ran tests for all classes in the package,
regardless of the module.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

AFAIK, this has always been the behaviour (and it's always been annoying).

--Dave Griffith

0
Comment actions Permalink

Do you think we should make it across module dependencies or just in a given module?

0
Comment actions Permalink

In general, if you're clicking on a non-leaf node the project view, it should act like a folder rather than a package. That's what "Find In Path", "Optimize Imports", "Synchronize" and pretty much everything else does. It's only the JUnit commands that act differently. This violates least surprise, and has the surprising side-effect that there is no way in the product to say "Run all of the tests in module ]]>". I figured this was all just an unfortunate side-effect of your JUnit runner implementation, but if it's an intentional design choice, it's an odd one.

So, just the given module, please.

--Dave Griffith

0
Comment actions Permalink

Hello Dave,

Done.

But new module won't override default module for all JUnit configurations
if it was configured.

Thank you.
-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

In general, if you're clicking on a non-leaf node the project view, it
should act like a folder rather than a package. That's what "Find In
Path", "Optimize Imports", "Synchronize" and pretty much everything
else does. It's only the JUnit commands that act differently. This
violates least surprise, and has the surprising side-effect that there
is no way in the product to say "Run all of the tests in module
<foo>". I figured this was all just an unfortunate side-effect of
your JUnit runner implementation, but if it's an intentional design
choice, it's an odd one.

So, just the given module, please.

--Dave Griffith



0
Comment actions Permalink

I'm fairly sure, it worked better in 5.0, but I'll check again.

0
Comment actions Permalink

It would also be nice to be able to select several JUnit tests with Ctrl+Click and have it run those.

0
Comment actions Permalink

Cool, but I'm not sure what your caveat means.

--Dave Griffith

0
Comment actions Permalink

Hello Dave,

We need classpath from module 'main' to run tests, etc. That's why we do
not want to override this default by selected module.

Let's try ;)

Thank you

-


Anna Kozlova
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

Cool, but I'm not sure what your caveat means.

--Dave Griffith



0
Comment actions Permalink

Hi!

Now the JUnit integration seems to be totally broken. In 5622 I only get:
java.lang.ClassNotFoundException: com.intellij.rt.junit4.JUnit4Util
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:115)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

Cheers,
Robert

0
Comment actions Permalink

Hello Robert,

RB> Now the JUnit integration seems to be totally broken. In 5622 I only
RB> get:
RB> java.lang.ClassNotFoundException: com.intellij.rt.junit4.JUnit4Util
RB> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

This was indeed totally broken in 5622 and fixed in 5646.

--
Dmitry Jemerov
Software Developer
http://www.jetbrains.com/
"Develop with Pleasure!"


0
Comment actions Permalink

Sorry to say this, but now it's even worse than before 5622.
Now even the configurations I created for my modules don't work.
It looks like the collector now only collects tests from the specified package and not the tests from the subpackages. This has the effect that right-clicking on a source folder and executing 'Run "All Tests"' makes no sense unless you have any classes in the default package.

Having the switch "In single module" is nice but collecting of tests from subpackages is crucial for the JUnit integration to be useable.

"grumbling" ;) Robert

0

Please sign in to leave a comment.