GeezerVison is showing github.com — Add Cobertura unit test coverage. · cmitch9/sample-java-project@969b9f5
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: build.xml +13Lines changed: 13 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
171 | 171 | <copy todir="${build.dir}/test"> |
172 | 172 | <fileset dir="${test.dir}" excludes="**/*.java"/> |
173 | 173 | </copy> |
| 174 | + <!-- Test coverage --> |
| 175 | + <taskdef classpathref="test.classpath" resource="tasks.properties"/> |
| 176 | + <cobertura-instrument todir="${build.dir}/instrumented" |
| 177 | + datafile="${build.dir}/cobertura.ser"> |
| 178 | + <fileset dir="${build.dir}/classes"> |
| 179 | + <include name="**/*.class"/> |
| 180 | + </fileset> |
| 181 | + </cobertura-instrument> |
174 | 182 | </target> |
175 | 183 |
|
176 | 184 | <target name="test" depends="test-compile" description="Run the unit tests."> |
177 | 185 | <junit fork="yes"> |
178 | 186 | <classpath> |
| 187 | + <pathelement path="${build.dir}/instrumented"/> |
179 | 188 | <pathelement path="${build.dir}/classes"/> |
180 | 189 | <pathelement path="${build.dir}/test"/> |
181 | 190 | <path refid="test.classpath"/> |
182 | 191 | </classpath> |
| 192 | + <sysproperty key="net.sourceforge.cobertura.datafile" |
| 193 | + file="${build.dir}/cobertura.ser"/> |
183 | 194 | <batchtest> |
184 | 195 | <formatter type="brief" usefile="false"/> |
185 | 196 | <fileset dir="${build.dir}/test"/> |
186 | 197 | </batchtest> |
187 | 198 | </junit> |
| 199 | + <cobertura-report srcdir="${src.dir}" destdir="${dist.dir}/test" |
| 200 | + datafile="${build.dir}/cobertura.ser"/> |
188 | 201 | </target> |
189 | 202 |
|
190 | 203 | <!-- Maven repository support --> |
|
Collapse file
Copy file name to clipboardExpand all lines: ivy.xml +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
18 | 18 | <!-- Unit Test --> |
19 | 19 | <dependency org="junit" name="junit" rev="4.10" |
20 | 20 | conf="test->default"/> |
| 21 | + <dependency org="net.sourceforge.cobertura" name="cobertura" rev="1.9.4.1" |
| 22 | + conf="test->default"> |
| 23 | + <exclude module="ant"/> |
| 24 | + </dependency> |
21 | 25 |
|
22 | 26 | <!-- Static Analysis --> |
23 | 27 | <dependency org="com.puppycrawl.tools" name="checkstyle" rev="5.5" |
|