How to get code coverage if the tests fails

3,125 views
Skip to first unread message

anuja...@tsepak.com

unread,
Dec 18, 2015, 3:13:51 AM12/18/15
to JaCoCo and EclEmma Users
Hi,

I have few instrumented test cases and when all the tests passes then I am getting coverage report but when any test fails then I don’t get coverage report. how to fix this. I want the coverage report even though my test fails. please let me know if anyone have any idea about how to do it.

Regards,
Anuja

Marc R. Hoffmann

unread,
Dec 18, 2015, 4:51:06 AM12/18/15
to jac...@googlegroups.com
Hi Anuja,

how do you execute your tests? In case you use a build System like Ant
or Maven you need to configure your build in a way that failed test
cases do not fail the build. JaCoCo itself is not aware of the test
results at all. It records code coverage in any case.

Regards,
-marc

Anuja Jain

unread,
Dec 18, 2015, 5:00:43 AM12/18/15
to jac...@googlegroups.com
Hi Marc,

I am using Gradle .can you please tell me how to configure that failed test case should not fail the build.

Regards,
Anuja

--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/eMFn90cdrg8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/5673D708.2000908%40mountainminds.com.

For more options, visit https://groups.google.com/d/optout.


This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any views expressed by the sender in this communication are those of the sender alone and do not necessarily express the views or the policy of the organization unless intended to do so. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. If you have received this email in error please immediately notify ad...@tsepak.com and delete this email from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Thank you.

Anuja Jain

unread,
Dec 18, 2015, 5:06:14 AM12/18/15
to jac...@googlegroups.com, hoff...@mountainminds.com
Hi Marc,

I am using Gradle .can you please tell me how to configure that failed test case should not fail the build.

Regards,
Anuja
On Fri, Dec 18, 2015 at 3:21 PM, Marc R. Hoffmann <hoff...@mountainminds.com> wrote:
--
You received this message because you are subscribed to a topic in the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jacoco/eMFn90cdrg8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/5673D708.2000908%40mountainminds.com.

For more options, visit https://groups.google.com/d/optout.

Marc R. Hoffmann

unread,
Dec 18, 2015, 5:09:32 AM12/18/15
to jac...@googlegroups.com
Hi Anuja,

please understand that we cannot provide support for Gradle here. But maybe you simply check Grade documentation:
The task has an ignoreFailures property to control the behavior when tests fail. The Test task always executes every test that it detects. It stops the build afterwards if ignoreFailures is false and there are failing tests. The default value of ignoreFailures is false.

https://docs.gradle.org/current/userguide/java_plugin.html#sec:java_test

Regards,
-marc
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. Any views expressed by the sender in this communication are those of the sender alone and do not necessarily express the views or the policy of the organization unless intended to do so. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. If you have received this email in error please immediately notify ad...@tsepak.com and delete this email from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited. Thank you. --
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/CAHHogTQQ1AKU_JE5n2N-9vEd%2BNi%3DAR_%2BGQBJ4x%3Dh6zoVB7OvCw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.


-- 
Marc Hoffmann
hoff...@mountainminds.com
_______________________________________________
Mountainminds GmbH & Co. KG

Nussbaumstr. 4 * 80336 Muenchen * Germany 
Phone/Fax +49-700-68664637 * 0700-MTNMINDS

Registergericht Muenchen * HRA 80201
Mountainminds Verwaltungs GmbH
Registergericht Muenchen * HRB 143183
Geschaeftsfuehrer Marc Hoffmann

Anuja Jain

unread,
Dec 18, 2015, 6:14:09 AM12/18/15
to jac...@googlegroups.com, hoff...@mountainminds.com
Hi,
Thanks for your response. I am able to get coverage report even though the test fails but the report says 0%.
I have added below code in gradle -
project.gradle.taskGraph.whenReady {
   connectedDebugAndroidTest {
       ignoreFailures = true
   }
}

Regards,
Anuja





For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages