您的位置:首页 > Web前端 > HTML

软件测试__findbugs+ant使用导出Html缺陷文档

2014-07-17 12:08 1131 查看
1. 准备工作





2. 将这两个压缩包解压到本地;

3. 分别配置环境变量:

创建系统变量ANT_HOME,并添加到path
中:





创建系统变量FINDBUGS_HOME,并添加到path
中:





4. 开始任务:

编写ant脚本,即:build.xml文件,讲解如图所示:



源码:

<project name="QYOA">

<path id="findbugs.path">

<fileset dir ="D:\zyy\findbugs-2.0.3\findbugs">

<include name ="**/*.jar"/>

</fileset>

</path>

<taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref ="findbugs.path"/>

<property name ="findbugs.home" value ="D:\zyy\findbugs-2.0.3\findbugs"/>

<target name ="findbugs">

<findbugs home ="D:\zyy\findbugs-2.0.3\findbugs" jvmargs="-Xmx884m" output ="html" outputFile ="D:/findbugs.html">

<class location ="D:\zyy\apache-tomcat-6.0.39\webapps\qyoa\WEB-INF\classes"/>

<auxClasspath path="D:\zyy\findbugs-2.0.3\findbugs\lib\findbugs-ant.jar"/>

<auxClasspath>

<fileset dir="D:\zyy\apache-tomcat-6.0.39\webapps\qyoa\WEB-INF\lib" includes="**/*.jar"/>

</auxClasspath>

<sourcePath path ="E:\workspace\qyoa\src"/>

</findbugs>

</target>

</project>

5. 生成Findbugs Repost:

运行 cmd 进入Dos窗口,进入到build.xml所在的目录,输入 ant findbugs
回车。

导出成功如图:



6. 可能遇到的问题:

由于工程比较大,在导出html时可能会产生一个空白的html。此时可能是JVM内存的错误(堆栈信息之类的),此时将<findbugs>的jvmargs属性改大,如改为jvmargs=”-Xmx1000m”,c此属性是可选的,也可以省略。

7.
最主要的是FindBugs可以帮助我们找出那些bugs。可以参考:http://findbugs.sourceforge.net/bugDescriptions.html

8. 部分参数说明:



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: