How to view code coverage details in Intellij - intellij-idea

When I run Code Coverage -either as part of invoking a unit test or from Analyze | Generate Coverage Report the result is only a one-line summary as shown:
Instead what we want is to see coverage by class - to hone in on the undertested areas. Even better would be detailing per-class areas (to the lines?) Does IJ have any of those capabilities?

Aha! It show up in the Explorer. Now there really should also be a text report .. so if anyone knows where that is or how to generate it another answer would be appreciated.
NOte: I can not show the full path names for confidentiality reasons

From the Intellij documentation. To generate a code coverage report
Do one of the following:
On the main menu, choose Analyze | Generate Coverage Report.
In the toolbar of the Coverage tool window, click exportToTextFile.
In the Generate Coverage Report dialog box that opens, specify the target directory where the generated report will be stored, and optionally select the check box Open generated HTML in browser.
Click Save. IntelliJ IDEA will store the generated report to the specified location, and also open it in the default browser, if the corresponding check box has been selected.

Related

How to locate Intellji IDEA "Generate Test" related code?

Right click on a open Java file, we can get Generate item:
Then click Test and go on, we can generate target Unit Test:
I want to develop a new Intellji IDEA plugin base on upper build-in 'Test generator' feature, I want to check related IDEA source code, I just guss may be in some .jar in com.jetbrains.ideaIC library, and fail to locate it for a long time:
I have no better idea about how to locate the code.
Could you tell me where is the related source code, or how to better locate it?
Thanks for your idea!!!
This is the related package in the source code https://github.com/JetBrains/intellij-community/tree/0e2aa4030ee763c9b0c828f0b5119f4cdcc66f35/java/java-impl/src/com/intellij/testIntegration/createTest

IntelliJ Test Code Coverage not displayed in code

I'm coming from Eclipse, where code coverage is very conveniently displayed in the code as well as a table when running JUnit tests.
In IntelliJ, I thus far have no idea how to get this working, and some of the things that I have tried seem to differ from the manual.
I have a suite of test cases, and try to run them using "Run with Coverage". What I am used to from Eclipse is that after the test run, a coverage report is shown and that the covered lines in the code are displayed in green, and uncovered lines are displayed in red.
However, this does not happen. No coverage report is shown, and no lines are highlighted. This differs from the behaviour described in https://www.jetbrains.com/help/idea/running-test-with-coverage.html
What do I have to do in order to have coverage data displayed both in code and as a statistics in InetlliJ?
EDIT: Added test run configuration
EDIT 2:
For reference, this is how my Ceal-Delve project looks like when I run the tests in Eclipse. I would expect that IntelliJ also supports code coverage like this. At the very least I have found images, documentations and settings that all imply that something like this should also work in IntelliJ.
It depends on your project structure. For example, for maven project it will work automatically.
Check you Run/Edit Configurations settings window:

List of all errors in project in CLion

CLion 2016.2 helpfully detects potential errors in the file you're editing, which can be seen in the validation bar to the right of the code.
That's just a single file though, is there a way (like a tool window) to get a list of all such warnings in the whole project, or specific parts of it?
Bonus points if it also lists warnings and errors from the compiler, though that's less important, because the compiler output already includes any it found.
Yes, it is possible. The feature you are looking for is called the Inspector.
Do: Find Action... | Inspect Code. It will show a pop-up that will allow you to select the scope: file, whole project, custom, and the Inspection profile (you can choose the type of errors you want to see):
After clicking OK, this is an example of the output, that you can navigate with the mouse or with keyboard shortcuts:
In version 2017.2, I have it under Code | Inspect Code....
You can also right click a folder in Project view and select Inspect Code... there to be able to check only that folder.

No coverage in 'all classes in scope' in Intellij

In Intellij IDEA 14.1.5 Community edition, I imported maven to get coverage from jacoco.exec file. Steps followed
right click on imported module.
select Analyze-->Show Converage Data.
provided valid jacoc.exec file and click 'show selected'
Instead of coverage i'm getting error as no coverage in 'all classes in scope'
can anybody suggest what is wrong?
I had the same thing happen to me.
I was able to fix this by going to "Edit Configurations", to the "Code Coverage" tab.
I'm not sure what caused it, but the wrong package namespace was listed there. I updated the entry there and my subsequent test run with code coverage succeeded.
It happens if your test class and class to test are in different package structures.
My test class was in:
com.tools.api
Class to be tested was in:
com.tools.ws
Once I've corrected the pattern as com.tools.* in the code coverage tab, I was able to see coverage results.
I had the same problem and found solution here.
In the Code Coverage tab, define the following options:
Specify the scope to measure code coverage for. Do one of the following:
To specify a class, click the Add Class button.
To specify a package, click the Add Package button.
I was able to fix this issue by:
Open Edit Configurations menu
Click on Modify Options > Coverage settings > Specify classes and packages
In the new box that appears, click on the plus to add a package
Select a high level package from the project

How to Run Ada Code in GPS

In GNAT Programming Studio, how do you run the program? I see it compiled successfully, but I do not see where my program has started running. I would like to test it.
First, you have to select your Main procedure in the project properties (see the "main files" tab). You can actually choose multiple files for multiple executables.
Next, you have to build it - either by pressing F4 for the first Main File in the list, or by choosing it in the Build->Project submenu, or by choosing "build all" in the Build->Project submenu (or use the toolbar for the menu entries).
Last, you can choose, which of your Main Files to run by choosing it in the Build->Run menu, or by pressing shift+F2 for the first file in the list. Enter the parameters in the dialog and press OK.
There should be a new Tab next to the Messages panel, where all output is placed, and you can use it for input, too. You could choose to use an external terminal in the run dialog.
If you want to debug it, have a look at the Debug menu. Read the documentation for more information.
Last, you can choose, which of your Main Files to run by choosing it in the Build->Run menu, or by pressing shift+F2 for the first file in the list. Enter the parameters in the dialog and press OK.
Whatever I enter here, e.g. either the name of the project, Primes_Count or the name of what I see to be the 'executable', Primes_Count.o, it just does not run.
And I get this message output on the Messages window :
Could not locate executable on path: Primes_Count.o
I don't see why Ada is making such a big deal out of the Run step.
If there is another stage between making the .o file and a finished Ada executable, then surely it is something that the GPS system can take care of itself . . .
December.
OK now, sorted. The GPS panel governing this [ Project menu > Edit Proj Props > Main Files tab ] setting was blacked out until clicked.
Running available now and working well.
it is Project->Properties-> Main Files add your file to run. This will sort out the issue.