应用利器组合牛

内燃机2021年09月06日

看标题就知道,这个是开发一个Java应用的利器组合,使用Ant完成工程的构建(Build),使用JUnit完成单元测试,使用Cobertura完成代码覆盖测试,也可以辅助查找性能瓶颈和一些类型的BUG,下面是一个完整的l范例,可以完全拿来用,不需任何修改,只要你的目录和这里的目录一致(应该也是很通用的):

下载下面的l文件

文件内容:

project default=\"all\"

!? =================================================================== ?

!? Definitions ?

!? =================================================================== ?

property name=\"base-dir\" location=\".\" /

property name=\"lib-dir\" location=\"${base-dir}/lib\" /

property name=\"src-dir\" location=\"${base-dir}/src\" /

property name=\"testcase-dir\" location=\"${base-dir}/test\" /

property name=\"out-dir\" location=\"${base-dir}/classes\" /

property name=\"report-dir\" location=\"${base-dir}/report\" /

property name=\"junit-dir\" location=\"${report-dir}/junit\" /

property name=\"junit-xml-dir\" location=\"${junit-dir}/xml\" /

property name=\"junit-html-dir\" location=\"${junit-dir}/html\" /

property name=\"cobertura-dir\" location=\"${report-dir}/cobertura\" /

property name=\"cobertura-xml-dir\" location=\"${cobertura-dir}/xml\" /

property name=\"cobertura-html-dir\" location=\"${cobertura-dir}/html\" /

property name=\"instrumented-dir\" location=\"${report-dir}/instrumented\" /

property name=\"instrument-file\" location=\"${instrumented-dir}/r\" /

property name=\"r\" value=\"${instrumented-dir}\" /

path id=\"l\"

pathelement location=\"${out-dir}\" /

fileset id=\"alljars\" dir=\"${lib-dir}\"

include name=\"**/*.jar\" /

/fileset

/path

!? include the cobertura building jars ?

path id=\"asspath\"

path refid=\"l\" /

/path

!? define the cobertura property file ?

taskdef classpathref=\"asspath\" resource=\"operties\"/

!? =================================================================== ?

!? Project Targets ?

!? =================================================================== ?

target name=\"init\" description=\"initialize the project env.\"

!? create the output folder ?

mkdir dir=\"${out-dir}\" /

mkdir dir=\"${report-dir}\" /

copy todir=\"${out-dir}\"

fileset dir=\"${src-dir}\" includes=\"**/*.properties\" /

/copy

/target

target name=\"compile\" depends=\"init\"

javac srcdir=\"${src-dir}\" destdir=\"${out-dir}\"

classpath refid=\"l\" /

/javac

/target

!? =================================================================== ?

!? Unit Test Targets ?

!? =================================================================== ?

!? - - - - - - - - - - - - - - - - -

target: init

initialize the build env

- - - - - - - - - - - - - - - - - ?

target name=\"init-test\" description=\"initialize the test env.\"

但很快他们意识到有必要把它研发出来。因为在他们看来 !? create the output folder ?

mkdir dir=\"${junit-dir}\" /

mkdir dir=\"${junit-xml-dir}\" /

mkdir dir=\"${junit-html-dir}\" /

/target

!? - - - - - - - - - - - - - - - - -

target: compile-test

compile the test cases

- - - - - - - - - - - - - - - - - ?

target name=\"compile-test\" depends=\"compile\"

javac srcdir=\"${testcase-dir}\" destdir=\"${out-dir}\"

classpath refid=\"l\" /

/javac

/target

!? =================================

target: test

run the unit test

================================= ?

target name=\"test\" depends=\"init-test\"

junit fork=\"yes\" printsummary=\"on\" maxmemory=\"100m\"

sysproperty key=\"tafile\"

file=\"${instrument-file}\" /

classpath location=\"${instrumented-dir}\" /

classpath refid=\"asspath\" /

formatter type=\"xml\" /

batchtest todir=\"${junit-xml-dir}\"

fileset dir=\"${out-dir}\"

include name=\"**/Test*.class\" /

exclude name=\"**/*$*.class\" /

/fileset

/batchtest

/junit

junitreport todir=\"${junit-xml-dir}\"

fileset dir=\"${junit-xml-dir}\"

include name=\"TEST-*.xml\" /

/fileset

report format=\"frames\" todir=\"${junit-html-dir}\" /

/junitreport

/target

!? =================================================================== ?

!? Code Coverage Targets ?

!? =================================================================== ?

查看本文来源

北京治疗生殖器疱疹的方法
哈尔滨治疗妇科哪家医院好
黄芪生脉饮效果具体怎么样
相关阅读
小众且高薪的奢侈品管理各个领域,海外研究生课程学什么?

节俭男装品牌年年物价上涨已是常事,本年2年末,节俭品行内花旗银行LV年初...

2024-11-18
爱人是从互相爱慕到相互彼此产生了解

所选男人,还是所选个疼你的好。真情,缘故就是个倒是静的词儿。它不只是...

2024-10-28
陕西西安:传统文化 时尚表达

▲ 山西太原市非馀这两项跨媒体开发重现商业活动现场 一个是面塑创作者,...

2024-10-25
(月相)让腕表变得有为

如果要说是在手列于中的有什么特性是最不能效用的,我指出大概就只有节气...

2024-10-07
夏季这么热为什么还要做美缝?看剩这3点你就懂了!

春季骄阳似火,酷暑饥渴,不想必大部分朋友都不偏爱这种大雾吧,却是小编...

2024-09-04
Moschino 2022春夏系列,图案图案的趣味活力,彩色的鲜艳减龄

Moschino 的这些衣饰上,换用相异的紫色两者之间进行了对比和搭乘配,以对比...

2024-07-12
友情链接