Skip to content
Skip to breadcrumbs
Skip to header menu
Skip to action menu
Skip to quick search
Quick Search
Browse
Pages
Blog
Labels
Attachments
Mail
Advanced
What’s New
Space Directory
Feed Builder
Keyboard Shortcuts
Confluence Gadgets
Log In
Sign Up
Dashboard
Groovy
Copy Page
You are not logged in. Any changes you make will be marked as
anonymous
. You may want to
Log In
if you already have an account. You can also
Sign Up
for a new account.
This page is being edited by
.
Paragraph
Paragraph
Heading 1
Heading 2
Heading 3
Heading 4
Heading 5
Heading 6
Preformatted
Quote
Bold
Italic
Underline
More colours
Strikethrough
Subscript
Superscript
Monospace
Clear Formatting
Bullet list
Numbered list
Outdent
Indent
Align left
Align center
Align right
Link
Table
Insert
Insert Content
Image
Link
Attachment
Symbol
Emoticon
Wiki Markup
Horizontal rule
tinymce.confluence.insert_menu.macro_desc
Info
JIRA Issue
Status
Gallery
Tasklist
Table of Contents
Other Macros
Page Layout
No Layout
Two column (simple)
Two column (simple, left sidebar)
Two column (simple, right sidebar)
Three column (simple)
Two column
Two column (left sidebar)
Two column (right sidebar)
Three column
Three column (left and right sidebars)
Undo
Redo
Find/Replace
Keyboard Shortcuts Help
<p>Starting with v1.8, Cobertura will create detailed reports for Groovy source. It can be download from <a class="external-link" href="http://cobertura.sourceforge.net/download.html" rel="nofollow">http://cobertura.sourceforge.net/download.html</a><br /> Below is an example build file for using Cobertura in your project.</p> <p>Notice that you must compile your groovy source into .class files so that Cobertura can add instrumentation to those .class files.</p> <hr /> <p>build.xml</p> <hr /> <table class="wysiwyg-macro" data-macro-name="code" data-macro-default-parameter="xml" style="background-image: url(/plugins/servlet/confluence/placeholder/macro-heading?definition=e2NvZGU6eG1sfQ&locale=en_GB&version=2); background-repeat: no-repeat;" data-macro-body-type="PLAIN_TEXT"><tr><td class="wysiwyg-macro-body"><pre> <?xml version="1.0"?> <project name="sample" default="coverage-report" basedir="."> <!-- properties for project directory structure --> <property name="dir.src" value="."/> <property name="dir.build" value="build"/> <property name="dir.dist" value="dist"/> <property name="dir.lib" value="lib"/> <property name="dir.report" value="report"/> <!-- setup a project classpath that includes the external libs --> <path id="project.classpath"> <!-- include the classes in this project --> <pathelement location="${dir.build}"/> <!-- include external libraries --> <fileset dir="${dir.lib}" includes="**/*.jar"/> </path> <!-- add external tasks --> <taskdef name="groovyc" classpathref="project.classpath" classname="org.codehaus.groovy.ant.Groovyc"/> <taskdef name="groovy" classpathref="project.classpath" classname="org.codehaus.groovy.ant.Groovy"/> <!-- create output directories --> <target name="prepare" depends="clean"> <mkdir dir="${dir.build}"/> </target> <!-- clean --> <target name="clean" description="Remove all generated files."> <delete dir="${dir.build}"/> <delete dir="${dir.report}"/> <delete dir="target/instrumented-classes"/> <delete file="cobertura.ser"/> </target> <!-- compile java (if you have any) and groovy source --> <target name="runGroovyC" depends="prepare"> <groovyc srcdir="${dir.src}" destdir="${dir.build}" stacktrace="true"> <classpath refid="project.classpath"/> <javac debug="on" /> </groovyc> </target> <!--============================================--> <!-- Cobertura Test Coverage Tool --> <!--============================================--> <path id="cobertura.classpath"> <fileset dir="${dir.lib}/cobertura" includes="**/*.jar"/> <pathelement location="target/instrumented-classes"/> <pathelement location="${dir.src}"/> </path> <taskdef classpath="${dir.lib}/cobertura/cobertura.jar" resource="tasks.properties" classpathref="cobertura.classpath"/> <!-- adds the logging code to the already compiled class files --> <target name="instrument" depends="runGroovyC"> <delete quiet="false" failonerror="false"> <fileset dir="target/instrumented-classes" includes="**/*.class"/> </delete> <cobertura-instrument todir="target/instrumented-classes"> <fileset dir="${dir.build}"> <include name="**/*.class"/> <exclude name="**/*Test.class"/> </fileset> </cobertura-instrument> </target> <!-- setup class path to include instrumented classes before non-instrumented ones --> <path id="cover-test.classpath"> <fileset dir="${dir.lib}" includes="**/*.jar"/> <pathelement location="target/instrumented-classes"/> <pathelement location="${dir.build}"/> </path> <!-- run all my junit tests using the instrumented classes --> <target name="cover-test" depends="instrument"> <mkdir dir="${dir.report}/cobertura" /> <junit printsummary="yes" haltonerror="no" haltonfailure="no" fork="yes"> <formatter type="plain" usefile="true"/> <batchtest> <fileset dir="${dir.build}" includes="**/*Test.class" /> </batchtest> <classpath refid="cover-test.classpath"/> </junit> </target> <!-- create the html reports --> <target name="coverage-report" depends="cover-test"> <cobertura-report srcdir="${dir.src}" destdir="${dir.report}"/> </target> </project> </pre></td></tr></table> <p>See also: <a class="confluence-link" href="/display/GROOVY/Test+Coverage" data-linked-resource-id="59167" data-linked-resource-type="page" data-linked-resource-default-alias="Test Coverage" data-base-url="http://docs.codehaus.org">Test Coverage</a></p>
Please type the word appearing in the picture.
Attachments
Labels
Location
Watch this page
< Edit
Preview >
Loading…
Save
Cancel
Next hint
search
attachments
weblink
advanced