package-hierarchical view for JUnit test results

Answered

Hi,

 

I can't seem to get JUnit test results displayed in a package-hierarchical way. I'm not yet sure whether I'm looking for a way to get the package hierarchy *displayed* or whether the hierarchy gets lost when IntelliJ collects the results from JUnit.

Currently, the results get displayed like this (Foo1Test and Foo2Test are in package foo, the other two in package bar):

v <default package>
> Bar1Test
> Bar2Test
> Foo1Test
> Foo2Test

What I want them to be displayed like:

v bar
> Bar1Test
> Bar2Test
v foo
> Foo1Test
> Foo2Test

 

Steps to reproduce:

create new java project
create test folder, mark as test sources root
add junit dependency (junit:junit:4.12 from Maven)
create class foo.Foo inside src folder:

package foo;

public class Foo {
}

create class bar.Bar inside src folder:

package bar;

public class Bar {
}

create class foo.Foo1Test inside test folder:

package foo;

import org.junit.Test;

public class Foo1Test {

@Test
public void testConstructor() {
new Foo();
}

}

create class foo.Foo2Test inside test folder:

package foo;

import org.junit.Test;

public class Foo2Test {

@Test
public void testConstructor() {
new Foo();
}

}

create class bar.Bar1Test inside test folder:

package bar;

import foo.Foo;
import org.junit.Test;

public class Bar1Test {

@Test
public void testConstructor() {
new Bar();
}

}

create class bar.Bar2Test inside test folder:

package bar;

import org.junit.Test;

public class Bar2Test {

@Test
public void testConstructor() {
new Bar();
}

}

Run -> Run... -> Edit Configurations... -> + -> JUnit
Test kind: All in package
Package:
  (default package)
all else left to defaults, e.g.:
  Fork mode: none
  Repeat: once
  Search for tests: In single module
  ...

 

0
4 comments

Feel  free to create feature request on YouTrack: http://youtrack.jetbrains.com/issues/IDEA.

0
Avatar
Permanently deleted user

Is this feature not present at the moment? I'm confused now. The way the view says <default package> seems to me that it already has knowledge about packages, and only mistakenly assings the classes to the default package when they're actually in real packages. Please clarify -- if needed I'll open a feature request afterwards.

0

"Default package"  is used as parent for all test. In IDEA 2017.3 it'll be replaced with used framework name, but there is no option to group tests by packages.

0
Avatar
Permanently deleted user

Thanks for the clarification. I opened an issue on YouTrack: https://youtrack.jetbrains.com/issue/IDEA-181154

0

Please sign in to leave a comment.