IntelliJ Test Code Coverage not displayed in code - intellij-idea

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:

Related

How to see output from multiple File Watchers in JetBrains IDE

I'm using JetBrains GoLand IDE however I assume the answer would be common for any JetBrains IDE such as IntelliJ etc.
I've configured file watchers for:
go fmt, golint and go test
go fmt does not have output so it works fine.
golint and go test both have output. If I enable just one of them I see that output. If I enable both I see the output of golint for only a split second then it is replaced by the output of go test So I will never actually be able to read the output of golint
For now I solved this by making go test only display output on error, if it errors I figure I do not yet care about the output of golint but thought I'd ask anyway.
You don't need to enable go test as a File Watcher as the default test runner can execute on file changes.
To enable this feature, you can enable the Toggle test auto-rerun feature, which is the third button from top to bottom on the left side of the run test window. You can also configure the interval after which the tests run via the cog wheel.
Here's a reference for how to do this in IntelliJ IDEA, which is the same as in GoLand https://twitter.com/intellijidea/status/807239309992591361?lang=en
Known issue, please vote for WEB-14387 to be notified on any progress with it

Running a pre-existing .java

I'm switching from Sublime Text 3 to IntelliJ, I had a test.java file on my desktop that I used for small testing but now I am not able run the same in IntelliJ, the problem is it's not showing the file when I select run.
I tried experimenting with different projects created through IntelliJ and understand that I need to set Project to run the code, but again I don't see the file I want.
Here is the project selection screen
Here is what happens when I hit run
See this answer and this document.
You need to configure the content and source roots inside the Java module.
If you right click on test.java and click "Run 'test'", that will attempt to run your main class. Although you may have a NullPointer exception in your code. When you attempt to access a.get(0), the value will return null as there are no Integers in your ArrayList. Also generally class files are named with uppercase first characters. Hope this helps!

How can I force intellij to check all files?

When I'm using intellij sometimes I do very large refactors that the IDE can't help with. This often breaks a lot of files, but since I'm using either Typescript or Java it's relatively easy to find the problems.
My issue is that I can't seem to get Intellij to check those files unless I open them specifically.
The kind of checking I'm talking about isn't a specific inspection, it's just like the normal compilation problems.
So for example, I have a typescript project and I modified some stuff. When I open some of my React components intellij waits a second, and then highlights parts of it in red. I can go to those parts and see what the issue is.
I've tried forcing the inspector to run, and I've tried building the project, but neither one gives me the red squiggly love I need :^(
It feels like the project->build should force intellij to highlight all this stuff, but it seems to have no effect.

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 see live list of syntax errors in WebStorm 7 (or IntelliJ)?

While editing a JavaScript file, the IDE shows highlights on the lines that have problems and displays the lightbulb when you're on one of those lines.
How can I see a live list of all problems found in the current file (e.g. syntax errors)?
The only way I found so far was to manually run inspection and check the inspection window. That's quite cumbersome. Even the "Problems" section of the Project window updates itself automatically as soon as I change the code (even without saving) - but it doesn't display the actual errors (only which files have errors).
Apparently the IDE knows what errors exist in the file - I just can't find a way to see all of them in a list.
In every other IDE I know, it is a built-in, enabled-by-default, feature: eclipse, visual studio, brackets, etc.
Apparently this is an open issue on the IntelliJ family of products. Please upvote that issue if you feel it is missing as well!