How to show package name in Run window after running tests

Answered

I am running 2022.1 Ultimate on a Mac and 2022.2.1 Ultimate on Windows. When I run a test on my Mac, the Run window gives the fully qualified name of the class (eg com.example.controllers.MyControllerTest) then the list of tests that was run under it. However when I run the same test on my Windows machine I only get the class name (MyControllerTest) with the list of tests that was run under it. I would like the package names to show up as well but I can't find a setting for this or any preference I've changed that would strike me as the reason for the difference.

1
7 comments

Could you please provide the screenshot of the issue? Do you use Maven or Gradle project? Do you delegate tests running to Gradle? See https://i.imgur.com/AmWjMZR.png.

0

Since the code is private, I can point you to examples of what I'm seeing.

The first image taken from https://www.jetbrains.com/help/idea/viewing-and-exploring-test-results.html shows the Run window displaying only the class names of the test classes. This is what I see on my Windows machine. 

The second image taken from https://www.jetbrains.com/help/idea/spock.html#run_spock_test shows the Run window displaying the class name prefixed by the packages. This is what I see on my Mac.

The same project is being used on both machines. It is a Gradle project using Groovy and Spock for testing. Both IDEs are set to delegate to Gradle.

0

Please compare the run configurations you are using. When running all tests in the package, the results will be grouped by package like this:

You can see the package name at the top.

The second screenshot shows the results of a single class tests. Also, the second screenshot you provided is using Gradle delegation while the first is using JUnit configuration.

0

I have verified the run configurations are delegating to Gradle on my machine, like I said in my previous post. I also realize the two screenshots I provided use different run configurations because they are taken from the links provided, however that is not the point I am trying to make. If you look at the way each image displays the class names for the tests, one uses the packages starting with `com.mechanitis.dem...` the other only uses the class name. The reason this is so important is because I have tests in sub-packages under the initial package I am running from.

In your example if you add a sub package under pkg, IntelliJ makes no indication that the test class is in another package--only the top level package is shown: `(com.my)`.

I've set up a small example to illustrate this. Both examples are taken from the same machine, same project, but different versions of IntelliJ.

This is from 2022.1 and the desired behavior I'm looking for. As you can see Gradle was indeed used to run the tests. The packages are included before the class name and there is clear indication that the tests reside in different packages.

This is from 2022.2.1 and was also delegated to Gradle. Package names do not appear with the name of the class:

 

So looping back to my initial question, is there a way to show package names in addition to the class names when running 2022.2.1?

0

Looks like Gradle specific issue in the recent updates. Our team will reply back soon.

As a workaround, do not delegate test running to Gradle.

0

Thank you for the update.

This quote is a little confusing:

As a workaround, do not delegate test running to Gradle.

I just want to make sure the problem is understood correctly. I WANT to see sub-package names with the class name like the first picture from 2022.1 in my previous reply and neither Gradle nor IntelliJ will show sub-package names in 2022.2.1. The only way to see sub-packages is to delegate to Gradle in 2022.1.

 

 

0

JM we've opened an issue to investigate, you can follow it here https://youtrack.jetbrains.com/issue/IDEA-301495

2

Please sign in to leave a comment.