Java Negative test cases not adding up to the ECLEmma java code coverage

When I run sonar code coverage for a set of integration test cases then the code coverage gives high value with positive and valid test cases.
After that I add few more negative test cases for same set of java classes and the code coverage drops drastically by 10 to 20%.
I checked the surefire-reports and logs but I am not sure what is going wrong and how is it impacting.

I want to understand mechanism of Sonar reads sure fire reports.
jgdvishnuSoftware ArchitectAsked:
Who is Participating?
MogalManicConnect With a Mentor Commented:
Need more information.  If could be that there is something in the tests that you  added that changed the state of something.

You could also try commenting out the new rests to determine that was the actual cause. If it was,then reintroduce them one at a time.
jgdvishnuSoftware ArchitectAuthor Commented:
why is it neglected. Please help
jgdvishnuSoftware ArchitectAuthor Commented:
code coverage values are erratic and inconsistent.
I wanted to understand how the sonar reads sure fire reports for any test cases(positive and negative).
The new generation of project management tools

With’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

jgdvishnuSoftware ArchitectAuthor Commented:
how does sure fire report is read by sonar. what is the mechanism.
Perhaps that gives idea about it.
jgdvishnuConnect With a Mentor Software ArchitectAuthor Commented:
This was due to 3 reasons:-
1) Sure Fire just lists if there was error or not. there was an error happening in the last method that was lowering the coverage count. We need to check target/classes/sure-fire report.

2) step to test the code coverage is.
mvn clean
mvn install without test case
mvn test // look that there is no error.
then when we restart sonar server
then look for issues in
mvn sonar:sonar.
jgdvishnuSoftware ArchitectAuthor Commented:
my step gives more detail and i donot take credit for it.
All Courses

From novice to tech pro — start learning today.