{"id":553,"date":"2014-06-17T23:00:39","date_gmt":"2014-06-17T21:00:39","guid":{"rendered":"http:\/\/blog.ansuz.nl\/?p=553"},"modified":"2014-06-17T23:00:39","modified_gmt":"2014-06-17T21:00:39","slug":"coveralls-with-cobertura","status":"publish","type":"post","link":"http:\/\/blog.ansuz.nl\/index.php\/2014\/06\/17\/coveralls-with-cobertura\/","title":{"rendered":"Coveralls with Cobertura"},"content":{"rendered":"<p>If you want to keep track of your test coverage and\/or give others insight of the test coverage you can use <a href=\"http:\/\/coveralls.io\/\" target=\"_blank\">Coveralls.io<\/a>. Assuming you have already set up Cobertura, it is quite easy to get Coveralls integrated. There is an existing <a href=\"https:\/\/github.com\/kt3k\/coveralls-gradle-plugin\" target=\"_blank\">Gradle plugin<\/a> to convert and send Cobertura reports to Coveralls. Have a look at &#8220;<a title=\"Robolectric and Cobertura with Gradle\" href=\"http:\/\/blog.ansuz.nl\/index.php\/2014\/06\/01\/robolectric-and-cobertura-with-gradle\/\">Robolectric and Cobertura with Gradle<\/a>&#8220;, if you want to know how to set up Robolectric and Cobertura.<\/p>\n<p><strong>Gradle setup<\/strong><br \/>\nFirst add a dependency to &#8220;org.kt3k.gradle.plugin:coveralls-gradle-plugin:0.3.0&#8221;.<br \/>\nApply the &#8220;coveralls&#8221; plugin.<br \/>\nAfter that make sure that the cobertura plugin generates an XML report as well. In the Cobertura configuration, add the following: <\/p>\n<div id=\"ig-sh-1\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">code<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"code\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">coverageFormats = [&quot;html&quot;, &quot;xml&quot;]<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>If you&#8217;re not running on Travis (pro) you may need to add a\u00a0service name by specifying &#8220;service&#8221; in the coveralls plugin configuration.<\/p>\n<p><strong>Environment setup<\/strong><br \/>\nAdd a &#8220;COVERALLS_REPO_TOKEN&#8221; environment variable containing your coveralls token.<\/p>\n<p>Now that everything is set up, all you need to do is run the below to send a coverage report to Coveralls.<\/p>\n<div id=\"ig-sh-2\" class=\"syntax_hilite\">\n\n\t\t<div class=\"toolbar\">\n\n\t\t<div class=\"view-different-container\">\n\t\t\t\t\t\t<a href=\"#\" class=\"view-different\">&lt; View <span>plain text<\/span> &gt;<\/a>\n\t\t\t\t\t<\/div>\n\n\t\t<div class=\"language-name\">bash<\/div>\n\n\t\t\n\t\t<br clear=\"both\">\n\n\t<\/div>\n\t\n\t<div class=\"code\">\n\t\t<ol class=\"bash\" style=\"font-family:monospace\"><li style=\"font-weight: normal;vertical-align:top\"><div style=\"font: normal normal 1em\/1.2em monospace;margin:0;padding:0;background:none;vertical-align:top\">gradle coveralls<\/div><\/li>\n<\/ol>\t<\/div>\n\n<\/div>\n\n<p>If you want to look into the Gradle Coveralls plugin in\u00a0more detail, have a look at the\u00a0<span style=\"color: #373737;\"><a href=\"https:\/\/github.com\/kt3k\/coveralls-gradle-plugin\" target=\"_blank\">coveralls-gradle-plugin<\/a> project page.<\/span><\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>If you want to keep track of your test coverage and\/or give others insight of the test coverage you can use Coveralls.io. Assuming you have already set up Cobertura, it is quite easy to get Coveralls integrated. There is an &hellip; <a href=\"http:\/\/blog.ansuz.nl\/index.php\/2014\/06\/17\/coveralls-with-cobertura\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[],"class_list":["post-553","post","type-post","status-publish","format-standard","hentry","category-android"],"_links":{"self":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/comments?post=553"}],"version-history":[{"count":4,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/553\/revisions"}],"predecessor-version":[{"id":557,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/posts\/553\/revisions\/557"}],"wp:attachment":[{"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/media?parent=553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/categories?post=553"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.ansuz.nl\/index.php\/wp-json\/wp\/v2\/tags?post=553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}