IntelliJ Idea code coverage not working in editor - java

In Intellij Idea after running tests with coverage I don't see color indicators in the editor. I tried different code coverage tools (Intellij, Emma, JaCoCo), but result is the same. On clean project setup everything works.
Does it needs to be additional configured or it's a bug in Idea?
I'm using IntelliJ IDEA 14.1.4 Ultimate.

It's a bug in IDEA, so you should report it.
Be sure to include enough information to reproduce the problem. In your case, make a copy of your project and repeatedly remove irrelevant files, until you finally come to a point where everything works.

Related

JUnit tests works in IntelliJ but fails on eclipse and build server

I'm just confused why the same test works in IntelliJ but not in Eclipse or the Azure build server.
It would help to share the code I think, I just fill out a login Page and click some buttons.
For some reason that's to fast for eclipse and the build server, but I why it works normally on IntelliJ?
I'm new to IntelliJ and I also tried to disable the JUnit Plugin, but this won't help because you can't run any test without it.
EDIT: I also tried it in VS Code, with the Extension Pack for Java and it works the same way like in Eclipse.
I don't know what is different to IntelliJ, but something is wrong there.
I don't know the reason but I guess the problem is that IntelliJ is a little bit slower then the other IDE's on executing JUnit tests / or slower when using Appium.

IntelliJ IDEA: How to display warnings in the project tree?

I recently moved from Eclipse to IntelliJ and I was really used to see any kind of warnings in the tree of my project in eclipse.
I think in IntelliJ by default compilation errors are displayed in the project tree or maybe it worked by enabling the "build project automatically" setting. But I did't find any way to enable the same for simple warnings (e.g. unused imports).
Does somebody know how I could achieve this or anything similar to it so I can simple get informed about any warnings?
I would be happy about any help I can get
Most inspections run in the background only for the currently open file for the performance reasons, therefore there is no way to mark the files with inspection warnings in the project view.
Use Analyze | Inspect Code to get the list of the files with warnings.

No Code coverage in IntelliJ 2017

I have written some Test methods using Junit and mockito. My tests run fine. However, I am not able to see code coverage.
No matter which option I click on, nothing is shown in code coverage.
I clicked on EDIT to fix configuration seetings displayed in middle of code coverage window on right. This is what I get :
What should I do to get code coverage results ?
This is my folder structure :
To see coverage for production code change the pattern to com.cdk.dmg.asset.
You need to Enable coverage in test folders if you want see coverage in tests (this option is disabled on your screenshot and the pattern is set to record data for tests only, hence no results).
Make sure you have the Coverage plugin enabled! (yes, it's named literally just "Coverage")
Enabling it did it for me.
You don't need to download it from Marketplace, the plugin comes bundled with IntelliJ Idea.
It's my understanding that it should be enabled by default ..but for some reason that wasn't the case for me, so it might as well not be the case for you either.
In IntelliJ IDEA 2018.3 I had to change Test Runner to Gradle to solve the same problem in my Gradle-based project.
File | Settings Ctrl+Alt+S
Build, Execution, Deployment | Build Tools | Gradle | Runner
Run tests using: Gradle Test Runner
Only then I was able to see the coverage.
This is my first answer
you can follow the below steps to enable
Open Visual studio and goto Extensions
Select Manage extension
Search fine code coverage and select to enable
you will get red and green lines on your actual methods that showing that how much you covere the code in Unit test case.
Follow steps

How to set up Jacoco code coverage tool in Eclipse for viewing colors in Java code?

I have setup jacoco in jenkins as part of functional test job to generate code coverage report. But I feel its very tough to understand.
Somewhere I read that covered and uncovered lines of code are shown in colors in Eclipse. This is for functional tests which connect to a stage where the whole business logic has been deployed. This is present inside Eclipse also as part of the project. How to set it up?
What difference the setup has for unit tests?
You can download the Eclemma plugin from Eclipse marketplace.
Open Marketplace from Help menu.
Search for Eclemma Java Code Coverage.
Install and Restart Eclipse.
Right-Click on the project, select Coverage as -> JUnit Test
http://www.eclemma.org/userdoc/importexport.html mentions being able to import reports, but that they have to be exactly the same class files both when the report was generated and within the Eclipse workspace. It may work, it may not.

cobertura in eclipse

I just installed ecobertura plugin, but it looks like not a very user-friendly tool from within eclipse. is there any good plugin for cobertura in eclipse or article to describe how to use ecobertura?
I'm used to seeing code complexity and coverge etc in a very nice way.
I need to use cobertura, because the build system in the back-end uses it, so it makes sens to use it in the IDE as well.
Regards
I was looking for a tutorial for our team members to start using eCobertura and came across here. I end up writing one myself. Posting back here hope it may help others looking for a jump start.
http://kennethxu.blogspot.com/2012/01/cobertura-and-eclipse-ecobertura.html
From the sources:
there should be launch configuration's "filters" tab, for you to define what class to filter and analyze: see changeset 2ecbb202e8c5
there is no instances of "cyclomatic complexity" anywhere in the code.
But you still can fork the code base (like mileszk did) and add any feature you want (and contribute back to the main project of course ;) )
I am using Eclipse Luna and I had difficulty installing the ecobertura plugin. So I installed EclEmma plugin and it was intitutive to use it. After installing the plugin, restart the eclipse IDE.
To find the coverage of the test cases you have written, all you have to do is
Right click on the desired package or even the whole project > Coverage As > Junit Test
The Coverage View automatically appears. Or you can open the coverage view from Window > Show View > Other > Java > Coverage. Or you can just type "Coverage" in the Quick Access search box in the eclipse.
The Coverage view is capable of displaying the coverage percentage at project level, source folder level, package level, Class level and even at method level.
You can change the root level of the entries shown in the coverage tree by using the toolbar in the coverage view.
You can change the coverage parameters to method or Line or instruction or brach based on your requirement.
And finally you can export the test coverage results to HTML or XML or CSV formats by right-clicking anywhere inside the coverage view and selecting Export session.

Categories

Resources