I have just installed and configured Cover plugin in my IntelliJ 14, it seems to have got configured successfully, i.e. it has generated instrumented classes etc, and the project is compiling and running fine, but after executing various functionalities, when I go back to clover tab in IntelliJ, it just shows 0% coverage against all classes and packages, and the code continues to be in Red.
I am just adding extra debugs to make sure that the code is indeed being executed, and I see them coming in log each time, but coverage against those very same classes / method continues to be zero.
I have not included test-cases into my project yet as there are some compilation issues, but I believe it's not necessary for clover to work, as long as source code is being executed (be it through unit-tests or by invoking different functionalities by the user), clover considers it. Please correct me if I am wrong.
Any idea what could be missing here ??
I just created another sample Hello World project and there everything works, Clover shows 100% once program executes. Somehow it's not working only in my app project.
Flush Policy to Threaded has done the trick, wih that it's working now :)
To answer your questions -
1. Do you run your application on the same machine where you perform your build ?
2. Do you run your application from the same working directory as the build directory ?
3. Do you terminate your application before checking for code coverage results in IntelliJ ?
A. I was trying both ways, used to press 'Refresh' button & check while running, and also used to check after stopping the application, the coverage data never used to get updated with 'Diercted' Flush Policy.
4. Do you see any coverage recording files generated ?
A. With 'Directed' I used to see coverage.db.liverec getting created but with 0 KB, was never getting updated for some reason. The corresponding recording file for 'Threaded' (coverage.dbyqekww_i2ycmujh) is getting updated regularly. So that looks fine.
So what's the conclusion ... 'Directed' wasn't really suiting my application, is it ??
The most probably you have killed the JVM process and, as a consequence, a shutdown hook (Runtime.getRuntime().addShutdownHook()) was not called. That's why the "directed" flush policy did not create a recording file. In the "threaded" policy Clover creates a separate thread which writes a coverage recording file at specified time interval.
when I go back to clover tab in IntelliJ, it just shows 0% coverage against all classes and packages
Please excuse my basic question, but users quite often confuse the "Cloverage" view (Clover's one) with the "Coverage" view (IDEA coverage). Could you double-check if you have opened the correct one?
just created another sample Hello World project and there everything works, Clover shows 100% once program executes. Somehow it's not working only in my app project.
Could you tell how do you run your application? Do run JUnits directly from IDEA? Or maybe you're deploying your application on a server and running manual tests? Or something else? I'm asking because there may be an issue with a path to Clover database (i.e. the "Initstring" setting in File > Settings > Other settings > Clover) or an issue with a flush policy (i.e. you may need to switch to interval or threaded).
I have not included test-cases into my project yet as there are some compilation issues, but I believe it's not necessary for clover to work.
You're correct. There is no need to instrument test classes.
Thanks for quick response ...
I think I have opened the correct 'Cloverage' view only ... just attaching the screenshot here for your confirmation.
Mine is more of a stand alone application, it does communicate with the server at times, but it's not a web application, it's just a java.exe running in my machine. I haven't included any JUnit test-cases in my project yet. I am basically just compiling and running it from my machine, and then doing manual tests when it's up.
InitString is set to 'Automatic', please let me know if we should try changing it.
Thanks & Regards,
1. Do you run your application on the same machine where you perform your build? If no, then you will have to copy clover.db (coverage.db) to your test machine. If yes, then I have a next question: 2. Do you run your application from the same working directory as the build directory? If not, then please switch "Initstring" from "Automatic" to "User-specified", disable the "relative to project directory" checkbox, put path to the database. Thanks to this an absolute path will be used and your application running from a different working directory will be able to locate the database. If yes, then next question: 3. Do you terminate your application before checking for code coverage results in IntelliJ? If not, then you shall use the "interval" or "threaded" flush policy. As you perform manual testing, I suggest the "threaded" one. Open Clover Settings > Compilation. In the "Flush Policy" box select "threaded" and choose some reasonable interval (the default one is 5000ms which is quite long - I suggest reducing it to ~ 1 second). If yes, then: 4. Do you see any coverage recording files generated? They're named like "<db name><some hash code>" (e.g clover.dbaaaa_bbbbb) and shall be located in database's directory.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Hi Community! me again 🙂 If you’re a marketing team using Confluence, we want to hear your story! How did you start using Confluence? What are your use cases? What have been some of the benefits?...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs