How to configure Intellij code coverage for jar in library - java

I am attempting to generate code coverage for a jar that is in my library. I have a suite of tests that uses this jar and I would like to see how much coverage I am getting with my test suite. In Intellij's run/configuration menu, even if I manually specify to include all the classes in the jar, ex. "com.my.jar.*", I get 0% code coverage. In Eclipse, I was able to easily select the jar, hit 'Coverage', and get accurate results. Has anyone else converting to Intellij from Eclipse experienced the same issue?

I got stuck on this too - I was able to get it working in Eclipse instead of Idea

Related

Test Runner tab in IntelliJ 2018.3 CE not showing

I'm using IntelliJ 2018.3 CE. I have a java maven project (developed using springboot) in which the JUnit tests have already been written. However, when I try to run the tests, the output is always shown in the default run window, and NOT in the Test Runner Tab. In fact, I cannot make this window pop-up after a running a test.
I have Junit 4.12 in the external libraries of my project (as Maven: junit:junit:4.12). The test folders have been appropriately flagged as test resources.
I presume it has to deal with settings in IntelliJ but even with all the effort in the world, I wasn't able to find what is causing this.
Is someone experiencing the same issue? Or does someone know how to resolve this?
Any help would be very much appreciated.

idea, run findbugs with ant project

when I started programming I wrote small programs, and I can just click "run" and that's all. and I used findbugs in idea, and I just compiled my program, and then I clicked "run findbugs". But not I am working, and I have a big project. We use ant. So my question-how could I run findbugs in IDEA, using findbugs plugin? I found only solution write in build.xml code and after build it generates me .xml file with bugs. But could I get bugs in idea ? I want fast orienter, fast fix bugs, in idea. don't open xml/html. of course I have to do it after full build my application. But what I need to do? Thanks!

Code Coverage Source Annotation with EclEmma

I installed EclEmma for its source annotation abilities relating to code coverage, how it highlights code with various colors based on whether or not that code is hit during execution. I intend to use this information for debugging purposes. The default install adds a "launch with coverage" button, which is what I want. This works perfectly for the entry point into the program; that entire source file gets beautiful coverage information smeared all over it. Unfortunately none of the other project files get the same treatment.
When I go over to the new coverage tab I see my source folder structure and all of my source files are listed along with coverage percentages. This is nice, but I would really like it to add the coverage annotations to my other source files so that I can review code coverage line by line in the rest of my project. Presently even clicking on them in the coverage tab with the percentage sitting directly to the right opens the plain unannotated source file (well, unannotated besides Eclipse's normal annotations for Java code). How can I get EclEmma to add source code coverage information to all of my source files, not just the one containing the point of entry to the program?
I suspect that there is a simple fix that I am missing, but the best I can get from the relevant documentation is how to change the color of the annotations.
For reference I am using Eclipse 4.2.1 for Java development. My EclEmma installation is the one from the Eclipse Marketplace.
Thank you for your time,
-- Techrocket9
For unknown reasons the issue seems to have resolved itself. I can only conclude that the EclEmma does not require alteration to display source annotations for other files, and that a bug in my particular Eclipse install triggered the issue and that the bug was fixed in an Eclipse or EclEmma update.

Is Code Coverage Plugin still available in NetBeans 7.0? How can I use it?

I've been searching on the internet on tutorials of code coverage test in NetBeans.
However, most tutorials use a plugin called NetBeans Code Coverage Plugin, which should be found in the 'Available Plugins'. However, it's not there.
So, how can I test Java code coverage in NetBeans 7.0?
You can find both Cobertura Module Test Coverage and Maven Test Coverage in Available Plugins. You should choose one according to your build tool.
Have a look at this link for more info:
http://wiki.netbeans.org/MavenCodeCoverage
Following link will navigate to you at NetBeans Code Coverage Plugins.
http://plugins.netbeans.org/plugin/38945/unit-tests-code-coverage-plugin-updated-for-netbeans-7-0

JUnit report on Eclipse

The JUnit integration with eclipse is very nice. However, I would like a feature to be able to generate a quick report from the Unit Tests. It is possible to do so when running a headless build (and my nightly build is configured to do so), but sometimes I want to generate a report from the UI.
Is there anyway to do this? command line options maybe? an extra plugin? maybe the functionality is already there and I can't find it?
EDIT: I have a PDE build, as my project is an RCP application. Thus, running the tests from this build is not really straight-forward. I guess I could try to hack a smaller ANT script to do the test, but then probably I have to fight with the classpath to obtain what I want. I was hoping to find some extension to the already existing JUnit plugin that would provide the information on the tree view, but as an HTML document.
You can use ant and generate HTML report [I think you can use Ant in Eclipse]
I found these link but you can survey more:
Ant JUnitReport Task
JUnit Tutorial
JUint Report
I'm not sure if you want a "physical" report that you can distribution or just more information you can view in your IDE.
Either way I agree with SjB's advice on configuring Eclipse to run the ant script generating the report in your nightly build.
If it's not possible to run the nightly build locally, you can do some very simple build script hacking following the links in SjB's answer.
You also might want to check out the Ant JUnit Task Manual Page

Categories