build.properties文件:
Java代码
1 The source code for the examples can be found in this directory 2 src.dir=../src/java 3 src.conf.dir=../src/conf 4 test.dir=../test/java 5 test.conf.dir=../src/conf 6 7 The path to cobertura.jar 8 cobertura.dir=cobertura 9 10 Classes generated by the javac compiler are deposited in this directory 11 classes.dir=../bin 12 13 Instrumented classes are deposited into this directory 14 instrumented.dir=instrumented 15 16 All reports go into this directory 17 reports.dir=reports 18 19 Unit test reports from JUnit are deposited into this directory 20 reports.xml.dir=${reports.dir}/junit-xml 21 reports.html.dir=${reports.dir}/junit-html 22 23 Coverage reports are deposited into these directories 24 coverage.xml.dir=${reports.dir}/cobertura-xml 25 coverage.html.dir=${reports.dir}/cobertura-html 26 |
编写示例代码:
Hello.java
Java代码
1 package com.xmatthew.practise.cobertura; 2 3 public class Hello { 4 5 public String birthday(String name) { 6 return "happy birthday to " + name; 7 } 8 9 public String christmas(String name) { 10 return "merry christmas " + name; 11 } 12 13 } |