??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产中文字幕在线视频综合,欧美sm精品调教视频,91麻豆产精品久久久久久http://www.aygfsteel.com/zhangzhong1018/category/25549.htmlstudy ruby on railszh-cnFri, 19 Oct 2007 03:36:39 GMTFri, 19 Oct 2007 03:36:39 GMT60HttpUnitq行集成试http://www.aygfsteel.com/zhangzhong1018/articles/153254.htmlleolileoliTue, 16 Oct 2007 06:07:00 GMThttp://www.aygfsteel.com/zhangzhong1018/articles/153254.htmlhttp://www.aygfsteel.com/zhangzhong1018/comments/153254.htmlhttp://www.aygfsteel.com/zhangzhong1018/articles/153254.html#Feedback0http://www.aygfsteel.com/zhangzhong1018/comments/commentRss/153254.htmlhttp://www.aygfsteel.com/zhangzhong1018/services/trackbacks/153254.html 

内容摘要

HttpUnit是一个集成测试工P主要xWeb应用的测试,提供的帮助类让测试者可以通过Javacd服务器进行交互,q且服务器端的响应当作文本或者DOM对象q行处理。HttpUnitq提供了一个模拟Servlet容器Q让你可以不需要发布ServletQ就可以对Servlet的内部代码进行测试。本文中作者将详细的介l如何用HttpUnit提供的类完成集成试?/p>

1  HttpUnit?/strong>

HttpUnit是SourceForge下面的一个开源项目,它是ZJUnit的一个测试框Ӟ主要x于测试Web应用Q解决用JUnit框架无法对远EWeb内容q行试的弊端。当前的最新版本是1.5.4。ؓ(f)了让HtpUnit正常q行Q你应该安装JDK1.3.1或者以上版本?/p>

1.1  工作原理

HttpUnit通过模拟览器的行ؓ(f)Q处理页面框ӞframesQ?cookies,面跌{QredirectsQ等。通过HttpUnit提供的功能,你可以和服务器端q行信息交互Q将q回的网内容作为普通文本、XML Dom对象或者是作ؓ(f)链接、页面框架、图像、表单、表格等的集合进行处理,然后使用JUnit框架q行试Q还可以导向一个新的页面,然后q行新页面的处理Q这个功能你可以处理一l在一个操作链中的面?/p>

1.2  和其他商业工L(fng)Ҏ(gu)

商业工具一般用记录、回攄功能来实现测试,但是q里有个~陷Q就是当面设计被修改以后,q些被记录的行ؓ(f)׃能重用了Q需要重新录制才能l测试?/p>

举个例子Q如果页面上有个元素最先的设计是采用单选框Q这个时候你开始测试,那么q些工具记录的就是你的单w择动作Q但是如果你的设计发生了变化Q比如说我改成了下拉选择Q或者用文本框接受用户输入Q这时候,你以前录制的试q程无效了Q必要重新录制?/p>

而HttpUnit因ؓ(f)xҎ(gu)q些控g的内容,所以不你的外在表现Ş式如何变化,都不影响你已定试的可重用性?/p>

更多的关于httpunit的信息请讉Khttpunit的主?a >http://httpunit.sourceforge.net

2  作者的演示环境

pȝq_QWindows 2000 Server

应用服务器:(x)深圳金蝶的apusic3.0

开发工P(x) eclipse 2.1.2

3  HttpUnit安装、环境配|?/strong>

3.1  安装

1. 到HttpUnit的主http://httpunit.sourceforge.net下蝲最新的包文Ӟ当前的最新版本是1.5.4?

2. 下载的Zip包解压羃到c:/httpunit(后面?httpunit_home%引用该目?

3.2  环境配置

作者的演示E序都是在eclipse中开发、执行的Q所以环境配|都是以eclipseZQ如果你使用其他的开发工Ph据这些步骤进行环境配|?/p>

  1. 启动eclipseQ徏立一个java工程
  2. ?httpunit_home%/lib/*.jar; %httpunit_home%/jars/*.jar加入到该java工程的Java build Path变量?

4  如何使用httpunit处理面的内?/strong>

WebConversationcLHttpUnit框架中最重要的类Q它用于模拟览器的行ؓ(f)。其他几个重要的cLQ?/p>

WebRequestc,模仿客户hQ通过它可以向服务器发送信息?/p>

WebResponsec,模拟览器获取服务器端的响应信息?/p>

4.1  获取指定面的内?/strong>

4.1.1  直接获取面内容

System.out.println("直接获取|页内容Q?);
//建立一个WebConversation实例
WebConversation wc = new WebConversation();
//向指定的URL发出hQ获取响?
WebResponse wr = wc.getResponse( "http://localhost:6888/HelloWorld.html" );
//用getTextҎ(gu)获取相应的全部内?
//用System.out.println获取的内容打印在控制台?
System.out.println( wr.getText() );

4.1.2  通过GetҎ(gu)讉K面q且加入参数

System.out.println("向服务器发送数据,然后获取|页内容Q?);
//建立一个WebConversation实例
WebConversation wc = new WebConversation();
//向指定的URL发出h
WebRequest req = new GetMethodWebRequest( "http://localhost:6888/HelloWorld.jsp" );
//l请求加上参?
req.setParameter("username","姓名");
//获取响应对象
WebResponse resp = wc.getResponse( req );
//用getTextҎ(gu)获取相应的全部内?
//用System.out.println获取的内容打印在控制台?
System.out.println( resp.getText() );

4.1.3 通过PostҎ(gu)讉K面q且加入参数

System.out.println("使用Post方式向服务器发送数据,然后获取|页内容Q?);
//建立一个WebConversation实例
WebConversation wc = new WebConversation();
//向指定的URL发出h
WebRequest req = new PostMethodWebRequest( "http://localhost:6888/HelloWorld.jsp" );
//l请求加上参?
req.setParameter("username","姓名");
//获取响应对象
WebResponse resp = wc.getResponse( req );
//用getTextҎ(gu)获取相应的全部内?
//用System.out.println获取的内容打印在控制台?
System.out.println( resp.getText() );

大家x一下上面代码中打了下划U的两处内容Q应该可以看刎ͼ使用Get、PostҎ(gu)讉K面的区别就是用的h对象不同?/p>

4.2  处理面中的链接

q里的演C是扑ֈ面中的某一个链接,然后模拟用户的单为,获得它指向文件的内容。比如在我的面HelloWorld.html中有一个链接,它显C的内容是TestLinkQ它指向我另一个页面TestLink.htm. TestLink.htm里面只显CTestLink.html几个字符?/p>

下面是处理代码:(x)

System.out.println("获取面中链接指向页面的内容Q?);
//建立一个WebConversation实例
WebConversation wc = new WebConversation();
//获取响应对象
WebResponse   resp = wc.getResponse( "http://localhost:6888/HelloWorld.html" );
//获得面链接对象
WebLink       link = resp.getLinkWith( "TestLink" );
//模拟用户单击事g
link.click();
//获得当前的响应对?
WebResponse   nextLink = wc.getCurrentPage();
//用getTextҎ(gu)获取相应的全部内?
//用System.out.println获取的内容打印在控制台?
System.out.println( nextLink.getText() );

4.3  处理面中的表格

表格是用来控刉面显C的常规对象Q在HttpUnit中用数l来处理面中的多个表格Q你可以用resp.getTables()Ҏ(gu)获取面所有的表格对象。他们依照出现在面中的序保存在一个数l里面?/p>

[注意] Java中数l下标是?开始的Q所以取W一个表格应该是resp.getTables()[0]Q其他以此类推?/p>

下面的例子演C如何从面中取出第一个表格的内容q且他们@环显C出来:(x)

System.out.println("获取面中表格的内容Q?);
//建立一个WebConversation实例
WebConversation wc = new WebConversation();
//获取响应对象
WebResponse   resp = wc.getResponse( "http://localhost:6888/HelloWorld.html" );
//获得对应的表格对?
WebTable webTable = resp.getTables()[0];
//表格对象的内容传递给字符串数l?
String[][] datas = webTable.asText();
//循环昄表格内容
int i = 0 ,j = 0;
int m = datas[0].length;
int n = datas.length;
while (i<n){
j=0;
while(j<m){
System.out.println("表格中第"+(i+1)+"行第"+
(j+1)+"列的内容是:(x)"+datas[i][j]);
++j;
}
++i;
}

4.4  处理面中的表单

表单是用来接受用戯入,也可以向用户昄用户已输入信息(如需要用户修Ҏ(gu)据时Q通常?x)显CZ以前输入q的信息Q,在HttpUnit中用数l来处理面中的多个表单Q你可以用resp.getForms()Ҏ(gu)获取面所有的表单对象。他们依照出现在面中的序保存在一个数l里面?/p>

[注意] Java中数l下标是?开始的Q所以取W一个表单应该是resp.getForms()[0]Q其他以此类推?/p>

下面的例子演C如何从面中取出第一个表单的内容q且他们@环显C出来:(x)

System.out.println("获取面中表单的内容Q?);
//建立一个WebConversation实例
WebConversation wc = new WebConversation();
//获取响应对象
WebResponse   resp = wc.getResponse( "http://localhost:6888/HelloWorld.html" );
//获得对应的表单对?
WebForm webForm = resp.getForms()[0];
//获得表单中所有控件的名字
String[] pNames = webForm.getParameterNames();
int i = 0;
int m = pNames.length;
//循环昄表单中所有控件的内容
while(i<m){
System.out.println("W?+(i+1)+"个控件的名字?+pNames[i]+
"Q里面的内容?+webForm.getParameterValue(pNames[i]));
++i;
}

5  如何使用httpunitq行试

5.1  寚w面内容进行测?/strong>

httpunit中的q部分测试完全采用了JUnit的测试方法,即直接将你期望的l果和页面中的输出内容进行比较。不q这里的试q单多了,只是字符串和字符串的比较?/p>

比如你期望中的页面显C是中有一个表|它是面中的W一个表|而且他的W一行第一列的数据应该是显CusernameQ那么你可以使用下面的代码进行自动化试Q?/p>

System.out.println("获取面中表格的内容q且q行试Q?);
//建立一个WebConversation实例
WebConversation wc = new WebConversation();
//获取响应对象
WebResponse   resp = wc.getResponse( "http://localhost:6888/TableTest.html" );
//获得对应的表格对?
WebTable webTable = resp.getTables()[0];
//表格对象的内容传递给字符串数l?
String[][] datas = webTable.asText();
//对表格内容进行测?
String expect = "中文";
Assert.assertEquals(expect,datas[0][0]);

5.2  对Servletq行试

除了寚w面内容进行测试外Q有时候(比如开发复杂的Servlets的时候)Q你需要对Servlet本n的代码块q行试Q这时候你可以选择HttpUnitQ它可以提供一个模拟的Servlet容器Q让你的Servlet代码不需要发布到Servlet容器Q如tomcatQ就可以直接试?

5.2.1  原理?/strong>

使用httpunit试ServletӞ请创Z个ServletRunner的实例,他负责模拟Servlet容器环境。如果你只是试一个Servlet,你可以直接用registerServletҎ(gu)注册q个ServletQ如果需要配|多个ServletQ你可以~写自己的web.xmlQ然后在初始化ServletRunner的时候将它的位置作ؓ(f)参数传给ServletRunner的构造器?/p>

在测试ServletӞ应该记得使用ServletUnitClientcM为客L(fng)Q他和前面用q的WebConversation差不多,都承自WebClientQ所以他们的调用方式基本一致。要注意的差别是Q在使用ServletUnitClientӞ他会(x)忽略URL中的L地址信息Q而是直接指向他的ServletRunner实现的模拟环境?/p>

5.2.2  单测?/strong>

本实例只是演C如何简单的讉KServletq且获取他的输出信息Q例子中的Servlet在接到用戯求的时候只是返回一串简单的字符Ԍ(x)Hello World!.

1. Servlet的代码如下:(x)

public class MyServlet extends HttpServlet {
public void service(HttpServletRequest req, HttpServletResponse resp)
throws IOException
{
PrintWriter out = resp.getWriter();
//向浏览器中写一个字W串Hello World!
out.println("

    Hello World!");
    out.close();
    }
    }
    

2. 试的调用代码如下:(x)

//创徏Servlet的运行环?
    ServletRunner sr = new ServletRunner();
    //向环境中注册Servlet
    sr.registerServlet( "myServlet", MyServlet.class.getName() );
    //创徏讉KServlet的客L(fng)
    ServletUnitClient sc = sr.newClient();
    //发送请?
    WebRequest request   = new GetMethodWebRequest( "http://localhost/myServlet" );
    //获得模拟服务器的信息
    WebResponse response = sc.getResponse( request );
    //获得的l果打印到控制台?
    System.out.println(response.getText());
    

5.2.3  试Servlet的内部行?/strong>

对于开发者来_(d)仅仅试h和返回信息是不够的,所以HttpUnit提供的ServletRunner模拟器可以让你对被调用Servlet内部的行行测试。和单测试中不同Q这里用了InvocationContext获得该Servlet的环境,然后你可以通过InvocationContext对象针对request、response{对象或者是该Servlet的内部行为(非服务方法)q行操作?/p>

下面的代码演CZ如何使用HttpUnit模拟Servlet容器Qƈ且通过InvocationContext对象Q测试Servlet内部行ؓ(f)的大部分工作Q比如控制request、session、response{?/p>

//创徏Servlet的运行环?
    ServletRunner sr = new ServletRunner();
    //向环境中注册Servlet
    sr.registerServlet( "InternalServlet", InternalServlet.class.getName() );
    //创徏讉KServlet的客L(fng)
    ServletUnitClient sc = sr.newClient();
    //发送请?
    WebRequest request   = new GetMethodWebRequest( "http://localhost/InternalServlet" );
    request.setParameter("pwd","pwd");
    //获得该请求的上下文环?
    InvocationContext ic = sc.newInvocation( request );
    //调用Servlet的非服务Ҏ(gu)
    InternalServlet is = (InternalServlet)ic.getServlet();
    is.myMethod();
    //直接通过上下文获得request对象
    System.out.println("request中获取的内容Q?+ic.getRequest().getParameter("pwd"));
    //直接通过上下文获得response对象,q且向客L(fng)输出信息
    ic.getResponse().getWriter().write("haha");
    //直接通过上下文获得session对象Q控制session对象
    //lsession赋?
    ic.getRequest().getSession().setAttribute("username","timeson");
    //获取session的?
    System.out.println("session中的|(x)"+ic.getRequest().getSession().getAttribute("username"));
    //使用客户端获取返回信息,q且打印出来
    WebResponse response = ic.getServletResponse();
    System.out.println(response.getText());
    

[注意]

在测试Servlet的之前,你必通过InvocationContext完成Servlet中的serviceҎ(gu)中完成的工作Q因为通过newInvocationҎ(gu)获取InvocationContext实例的时候该Ҏ(gu)q没有被调用?/p>

6  ȝ

本文中,作者详l的演示和介l了如何使用HttpUnit提供的类来进行集成测试,主要实现以下操作Q?/p>

  1. 模拟用户行ؓ(f)向服务器发送请求,传递参?
  2. 模拟用户接受服务器的响应信息Qƈ且通过辅助cd析这些响应信息,l合JUnit框架q行试
  3. 使用HttpUnit提供的模拟Servler容器,试开发中的Servlet的内部行?

参考资?/strong>

  1. HttpUnit帮助  http://httpunit.sourceforge.net
  2. JUnit帮助  http://junit.org/index.htm


leoli 2007-10-16 14:07 发表评论
]]>
?ant 自动化测?Q{Q?/title><link>http://www.aygfsteel.com/zhangzhong1018/articles/142411.html</link><dc:creator>leoli</dc:creator><author>leoli</author><pubDate>Mon, 03 Sep 2007 10:00:00 GMT</pubDate><guid>http://www.aygfsteel.com/zhangzhong1018/articles/142411.html</guid><wfw:comment>http://www.aygfsteel.com/zhangzhong1018/comments/142411.html</wfw:comment><comments>http://www.aygfsteel.com/zhangzhong1018/articles/142411.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.aygfsteel.com/zhangzhong1018/comments/commentRss/142411.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/zhangzhong1018/services/trackbacks/142411.html</trackback:ping><description><![CDATA[<div align="center"><strong><font size="4">利用ant和junit实现单元试的自动化</font></strong></div> <div align="center"> </div> <div style="text-indent: 21.75pt">在Y件开发过E中Q我们通常需要对各个功能模块以至cȝҎ(gu)q行详细的测试。这U对最的软g单元q行验证的工作也叫做单元试Q单元测试通常在编码过E中q行Q在以测试驱动开发的目中,单元试是一w帔R要的工作Q但随着开发过E的深入Q我们所U篏的单元测试案例就?x)越来越多,面对成百上千个测试类Q单独运行每个案例不仅费Ӟ而且很难在以后的集成试中利用先前的单元试案例构徏Z个完整的试报告?/div> <div style="text-indent: 21.75pt">Junit是一个用于java软g试的开源项目,主要的应用也是作为单元测试,虽然设计短小Q但功能却是非常强大。目前有很多在junit上进行扩展的目帮助我们完成各种试。比如web性能试的httpunitQjmeterQ用于代码覆盖测试的hanselQ用于数据库性能试的dbunit{等Q应用遍布Y件测试的各个领域?/div> <div><span>    Ant</span>同样是一个非怼U的java目构徏工具。据a(chn)nt的创始hJames Duncan Davidson_(d)ant代表Q?Another Neat Tool"。同L(fng)Qant在英文中?#8220;蚂蚁“的意思,q又代表着它有建筑本领高超和nw虽,但功能却极其强大的意思(可以参看Q?a >http://ant.apache.org/faq.html#ant-name</a>Q,ant目?000q开始,一直未停止更新工作Q目前的最高版本是1.7.0?/div> <div style="text-indent: 21.75pt">在下面我们还需要用到java的IDE开发工具Eclipse。在最新的3.2版本中,eclipse已经整合了junit4、junit3.8.1和ant1.6.5。但׃只有在ant1.7.0以后版本中才开始支持junitQ因此需要我们从<a >http://ant.apache.org</a>下蝲最新的1.7.0Qƈ重新讄eclipse的Ant Home的位|指向ant1.7.0的lib包。如图:(x)</div> <div style="text-indent: 21.75pt"></div> <p><img alt="" src="http://p.blog.csdn.net/images/p_blog_csdn_net/lemonfamily/5b5d7614c4ef4c888333d067fdd7759e.png" /></p> <div></div> <div>Eclipse里面已经自带了junit4和junit3.8.1Q如果用的jdk环境?.0Qjdk1.5Q可以用junit4Q如果是1.4则用junit3.8.1。查看和讄目的jdk环境可以通过project ->properties ->java compiler.如图Q?/div> <div></div> <p><img style="width: 581px; height: 526px" height="526" alt="" src="http://p.blog.csdn.net/images/p_blog_csdn_net/lemonfamily/154a389d72b04d4f93724d35e996b5d5.png" width="588" /></p> <div style="text-indent: 17.95pt" align="center"> </div> <div><span>   </span>默认情况下,"Enable project specific settings" 选项是未选中的,则项目用当前操作系l默认的java环境Q跟你设|的java build path无关Q?/div> <div><span>   </span>下面Q我们创Z个测试项目,名字为:(x)testQƈ创徏两个源文件夹:src和test..把项目源文g和测试文件分开攑֜q两个文件夹中?/div> <div>我们在src~写一个测试类Q?/div> <div> </div> <table style="border-right: medium none; border-top: medium none; border-left: medium none; border-bottom: medium none; border-collapse: collapse" cellspacing="0" cellpadding="0" border="1"> <tbody> <tr> <td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 426.1pt; padding-top: 0cm; border-bottom: windowtext 1pt solid" valign="top" width="568"> <div align="left"><strong><span style="font-size: 10pt; color: #7f0055">package</span></strong><span style="font-size: 10pt; color: black"> com.widetrust;</span></div> <div align="left"> </div> <div align="left"><strong><span style="font-size: 10pt; color: #7f0055">public </span></strong><strong><span style="font-size: 10pt; color: #7f0055">class</span></strong><span style="font-size: 10pt; color: black"> CountService {</span></div> <div align="left"><span style="font-size: 10pt; color: black">     </span><strong><span style="font-size: 10pt; color: #7f0055">private </span></strong><strong><span style="font-size: 10pt; color: #7f0055">int </span></strong><span style="font-size: 10pt; color: #0000c0">summary</span><span style="font-size: 10pt; color: black">;</span></div> <div align="left"><span style="font-size: 10pt; color: black">     </span><strong><span style="font-size: 10pt; color: #7f0055">private </span></strong><strong><span style="font-size: 10pt; color: #7f0055">int </span></strong><span style="font-size: 10pt; color: #0000c0">count</span><span style="font-size: 10pt; color: black">;</span></div> <div align="left"><span style="font-size: 10pt; color: black">     </span><strong><span style="font-size: 10pt; color: #7f0055">public </span></strong><strong><span style="font-size: 10pt; color: #7f0055">boolean</span></strong><span style="font-size: 10pt; color: black"> stat(</span><strong><span style="font-size: 10pt; color: #7f0055">int</span></strong><span style="font-size: 10pt; color: black"> visitor){</span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: #0000c0">count</span><span style="font-size: 10pt; color: black">++;</span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: #0000c0">summary</span><span style="font-size: 10pt; color: black"> += visitor;</span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><strong><span style="font-size: 10pt; color: #7f0055">if</span></strong><span style="font-size: 10pt; color: black">(</span><span style="font-size: 10pt; color: #0000c0">summary</span><span style="font-size: 10pt; color: black">>1000 && </span><span style="font-size: 10pt; color: #0000c0">count</span><span style="font-size: 10pt; color: black">>2){</span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><strong><span style="font-size: 10pt; color: #7f0055">return </span></strong><strong><span style="font-size: 10pt; color: #7f0055">true</span></strong><span style="font-size: 10pt; color: black">;</span></div> <div align="left"><span style="font-size: 10pt; color: black">    }</span><strong><span style="font-size: 10pt; color: #7f0055">else</span></strong><span style="font-size: 10pt; color: black">{</span></div> <div align="left"><span style="font-size: 10pt; color: black">        </span><strong><span style="font-size: 10pt; color: #7f0055">return </span></strong><strong><span style="font-size: 10pt; color: #7f0055">false</span></strong><span style="font-size: 10pt; color: black">;</span></div> <div align="left"><span style="font-size: 10pt; color: black">    }</span></div> <div align="left"><span style="font-size: 10pt; color: black">     }</span></div> <div align="left"><span style="font-size: 10pt; color: black">}</span></div> </td> </tr> </tbody> </table> <div> </div> <div>在test文g夹写个测试该cȝc:(x)</div> <div> </div> <table style="border-right: medium none; border-top: medium none; border-left: medium none; border-bottom: medium none; border-collapse: collapse" cellspacing="0" cellpadding="0" border="1"> <tbody> <tr> <td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 426.1pt; padding-top: 0cm; border-bottom: windowtext 1pt solid" valign="top" width="568"> <div align="left"><strong><span style="font-size: 10pt; color: #7f0055">package</span></strong><span style="font-size: 10pt; color: black"> com.widetrust.test;</span></div> <div align="left"> </div> <div align="left"><strong><span style="font-size: 10pt; color: #7f0055">import</span></strong><span style="font-size: 10pt; color: black"> com.widetrust.CountService;</span></div> <div align="left"><strong><span style="font-size: 10pt; color: #7f0055">import</span></strong><span style="font-size: 10pt; color: black"> junit.framework.TestCase;</span></div> <div align="left"> </div> <div align="left"><strong><span style="font-size: 10pt; color: #7f0055">public </span></strong><strong><span style="font-size: 10pt; color: #7f0055">class</span></strong><span style="font-size: 10pt; color: black"> TestCountService </span><strong><span style="font-size: 10pt; color: #7f0055">extends</span></strong><span style="font-size: 10pt; color: black"> TestCase {</span></div> <div align="left"><span style="font-size: 10pt; color: black">    CountService </span><span style="font-size: 10pt; color: #0000c0">cs</span><span style="font-size: 10pt; color: black">;</span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><strong><span style="font-size: 10pt; color: #7f0055">protected </span></strong><strong><span style="font-size: 10pt; color: #7f0055">void</span></strong><span style="font-size: 10pt; color: black"> setUp() </span><strong><span style="font-size: 10pt; color: #7f0055">throws</span></strong><span style="font-size: 10pt; color: black"> Exception {</span></div> <div align="left"><span style="font-size: 10pt; color: black">        </span><span style="font-size: 10pt; color: #0000c0">cs</span><span style="font-size: 10pt; color: black"> = </span><strong><span style="font-size: 10pt; color: #7f0055">new</span></strong><span style="font-size: 10pt; color: black"> CountService();</span></div> <div align="left"><span style="font-size: 10pt; color: black">    }</span></div> <div align="left"> </div> <div align="left"><span style="font-size: 10pt; color: black">    </span><strong><span style="font-size: 10pt; color: #7f0055">protected </span></strong><strong><span style="font-size: 10pt; color: #7f0055">void</span></strong><span style="font-size: 10pt; color: black"> tearDown() </span><strong><span style="font-size: 10pt; color: #7f0055">throws</span></strong><span style="font-size: 10pt; color: black"> Exception {</span></div> <div align="left"><span style="font-size: 10pt; color: black">    }</span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><strong><span style="font-size: 10pt; color: #7f0055">public </span></strong><strong><span style="font-size: 10pt; color: #7f0055">void</span></strong><span style="font-size: 10pt; color: black"> testStat(){       </span></div> <div align="left"><span style="font-size: 10pt; color: black">    <em>assertEquals</em>(</span><strong><span style="font-size: 10pt; color: #7f0055">true</span></strong><span style="font-size: 10pt; color: black">, </span><span style="font-size: 10pt; color: #0000c0">cs</span><span style="font-size: 10pt; color: black">.stat(4000));</span></div> <div align="left"><span style="font-size: 10pt; color: black">    }</span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><strong><span style="font-size: 10pt; color: #7f0055">public </span></strong><strong><span style="font-size: 10pt; color: #7f0055">void</span></strong><span style="font-size: 10pt; color: black"> testStat2(){</span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: #0000c0">cs</span><span style="font-size: 10pt; color: black">.stat(2000);</span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: #0000c0">cs</span><span style="font-size: 10pt; color: black">.stat(2000);</span></div> <div align="left"><span style="font-size: 10pt; color: black">    <em>assertEquals</em>(</span><strong><span style="font-size: 10pt; color: #7f0055">true</span></strong><span style="font-size: 10pt; color: black">, </span><span style="font-size: 10pt; color: #0000c0">cs</span><span style="font-size: 10pt; color: black">.stat(3000));</span></div> <div align="left"><span style="font-size: 10pt; color: black">    }</span></div> <div align="left"><span style="font-size: 10pt; color: black">}</span></div> <div align="left"> </div> </td> </tr> </tbody> </table> <div> </div> <div style="text-indent: 21.75pt">当然我们可以利用eclipse的Run As Junit Test(快捷键:(x)Alt+Shift+X T)q行我们刚写好的试案例Q但有个问题是eclipse不能正确的同步我们的开发和试E序Q而且Q我们可能还希望试的过E中为我们提供一份详l的报告文Q以供我们在试后的改进q程中的讨论。现在我们用ant的自动编译功能来实现试的自动化Qƈ让它生成一份详l的试报告?/div> <div>  注意的是Qant自带了junit的支持包Q但目需要junit.jarQ还需要在目的lib文g夹中攄junit.jarQ(q里我假讑ַE目录存N目依赖组件的是lib文g夹)如果我们要单独用ant~译整个目Q需要在目构徏文gbuild.xml中定义编译所用到的lib包。当ӞZ省事Q我们也可以把项目依赖的lib包放到ant的设|项Global Entries 中,如图Q?/div> <p><img alt="" src="http://p.blog.csdn.net/images/p_blog_csdn_net/lemonfamily/c5fe2a70f8ed4eb0992ab6368b6ebdc5.png" /></p> <div> </div> <div>q里我们把项目依赖包都设|在build.xml中:(x)</div> <div>在项目的根目录创Z个build.xmlQ内容如下:(x)</div> <div> </div> <table style="border-right: medium none; border-top: medium none; border-left: medium none; width: 464.4pt; border-bottom: medium none; border-collapse: collapse" cellspacing="0" cellpadding="0" width="619" border="1"> <tbody> <tr> <td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 464.4pt; padding-top: 0cm; border-bottom: windowtext 1pt solid" valign="top" width="619"> <div align="left"><span style="font-size: 10pt; color: gray"><?xml version="1.0"?></span></div> <div align="left"> </div> <div align="left"><span style="font-size: 10pt; color: navy"><project </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"ant and junit" </span><span style="font-size: 10pt; color: navy">default=</span><span style="font-size: 10pt; color: green">"test auot junit and report" </span><span style="font-size: 10pt; color: navy">basedir=</span><span style="font-size: 10pt; color: green">"."</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: maroon"><!-- </span><span style="font-size: 10pt; color: maroon">定义工程依赖?/span><span style="font-size: 10pt; color: maroon">jar</span><span style="font-size: 10pt; color: maroon">包存攄位置</span><span style="font-size: 10pt; color: maroon"> --></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><property </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"lib.dir" </span><span style="font-size: 10pt; color: navy">value=</span><span style="font-size: 10pt; color: green">"lib"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><path </span><span style="font-size: 10pt; color: navy">id=</span><span style="font-size: 10pt; color: green">"classpath"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><fileset </span><span style="font-size: 10pt; color: navy">dir=</span><span style="font-size: 10pt; color: green">"${lib.dir}" </span><span style="font-size: 10pt; color: navy">includes=</span><span style="font-size: 10pt; color: green">"**/*.jar"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"></path></span></div> <div align="left"> </div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><property </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"output folder" </span><span style="font-size: 10pt; color: navy">value=</span><span style="font-size: 10pt; color: green">"classes"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><property </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"src folder" </span><span style="font-size: 10pt; color: navy">value=</span><span style="font-size: 10pt; color: green">"src"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><property </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"test folder" </span><span style="font-size: 10pt; color: navy">value=</span><span style="font-size: 10pt; color: green">"test"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><property </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"report folder" </span><span style="font-size: 10pt; color: navy">value=</span><span style="font-size: 10pt; color: green">"report"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"> </div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><target </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"clean"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><delete </span><span style="font-size: 10pt; color: navy">dir=</span><span style="font-size: 10pt; color: green">"report"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><echo></span><span style="font-size: 10pt; color: black">清除试报告文g </span><span style="font-size: 10pt; color: black">成功</span><span style="font-size: 10pt; color: black">!</span><span style="font-size: 10pt; color: navy"></echo></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"></target></span></div> <div align="left"> </div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><target </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"compile init"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><mkdir </span><span style="font-size: 10pt; color: navy">dir=</span><span style="font-size: 10pt; color: green">"${output folder}"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><echo></span><span style="font-size: 10pt; color: black">创徏~译文g?</span><span style="font-size: 10pt; color: black">成功</span><span style="font-size: 10pt; color: black">!</span><span style="font-size: 10pt; color: navy"></echo></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"></target></span></div> <div align="left"> </div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><target </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"report init"</span><span style="font-size: 10pt; color: navy">depends=</span><span style="font-size: 10pt; color: green">"clean"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><mkdir </span><span style="font-size: 10pt; color: navy">dir=</span><span style="font-size: 10pt; color: green">"${report folder}"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><echo></span><span style="font-size: 10pt; color: black">创徏试报告文g?</span><span style="font-size: 10pt; color: black">成功</span><span style="font-size: 10pt; color: black">!</span><span style="font-size: 10pt; color: navy"></echo></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"></target></span></div> <div align="left"> </div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><target </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"compile"</span><span style="font-size: 10pt; color: navy">depends=</span><span style="font-size: 10pt; color: green">"compile init"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><javac </span><span style="font-size: 10pt; color: navy">srcdir=</span><span style="font-size: 10pt; color: green">"${src folder}" </span><span style="font-size: 10pt; color: navy">destdir=</span><span style="font-size: 10pt; color: green">"${output folder}" </span><span style="font-size: 10pt; color: navy">classpathref=</span><span style="font-size: 10pt; color: green">"classpath"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><echo></span><span style="font-size: 10pt; color: black">目源文?/span><span style="font-size: 10pt; color: black">~译 成功</span><span style="font-size: 10pt; color: black">!</span><span style="font-size: 10pt; color: navy"></echo></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"></target></span></div> <div align="left"> </div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><target </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"test compile" </span><span style="font-size: 10pt; color: navy">depends=</span><span style="font-size: 10pt; color: green">"report init"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><javac </span><span style="font-size: 10pt; color: navy">srcdir=</span><span style="font-size: 10pt; color: green">"${test folder}" </span><span style="font-size: 10pt; color: navy">destdir=</span><span style="font-size: 10pt; color: green">"${output folder}" </span><span style="font-size: 10pt; color: navy">classpathref=</span><span style="font-size: 10pt; color: green">"classpath"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><echo></span><span style="font-size: 10pt; color: black">目试文g</span><span style="font-size: 10pt; color: black">~译 成功</span><span style="font-size: 10pt; color: black">!</span><span style="font-size: 10pt; color: navy"></echo></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"></target></span></div> <div align="left"> </div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><target </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"all compile" </span><span style="font-size: 10pt; color: navy">depends=</span><span style="font-size: 10pt; color: green">"compile, test compile"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"></target></span></div> <div align="left"> </div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"><target </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"test auot junit and report" </span><span style="font-size: 10pt; color: navy">depends=</span><span style="font-size: 10pt; color: green">"all compile"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><junit</span><span style="font-size: 10pt; color: navy">print summary=</span><span style="font-size: 10pt; color: green">"on" </span><span style="font-size: 10pt; color: navy">fork=</span><span style="font-size: 10pt; color: green">"true" </span><span style="font-size: 10pt; color: navy">showoutput=</span><span style="font-size: 10pt; color: green">"true"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">           </span><span style="font-size: 10pt; color: navy"><classpath></span></div> <div align="left"><span style="font-size: 10pt; color: black">              </span><span style="font-size: 10pt; color: navy"><fileset </span><span style="font-size: 10pt; color: navy">dir=</span><span style="font-size: 10pt; color: green"><span style="font-size: 10pt; color: green">"${lib.dir}</span>"</span><span style="font-size: 10pt; color: navy">includes=</span><span style="font-size: 10pt; color: green">"**/*.jar"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">              </span><span style="font-size: 10pt; color: navy"><pathelement </span><span style="font-size: 10pt; color: navy">path=</span><span style="font-size: 10pt; color: green">"${output folder}"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">           </span><span style="font-size: 10pt; color: navy"></classpath></span></div> <div align="left"><span style="font-size: 10pt; color: black">           </span><span style="font-size: 10pt; color: navy"><formatter </span><span style="font-size: 10pt; color: navy">type=</span><span style="font-size: 10pt; color: green">"xml"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">           </span><span style="font-size: 10pt; color: navy"><batchtest </span><span style="font-size: 10pt; color: navy">todir=</span><span style="font-size: 10pt; color: green">"${report folder}"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">              </span><span style="font-size: 10pt; color: navy"><fileset </span><span style="font-size: 10pt; color: navy">dir=</span><span style="font-size: 10pt; color: green">"${output folder}"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">                  </span><span style="font-size: 10pt; color: navy"><include </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"**/Test*.*"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">              </span><span style="font-size: 10pt; color: navy"></fileset></span></div> <div align="left"><span style="font-size: 10pt; color: black">           </span><span style="font-size: 10pt; color: navy"></batchtest></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"></junit></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"><junitreport </span><span style="font-size: 10pt; color: navy">todir=</span><span style="font-size: 10pt; color: green">"${report folder}"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">           </span><span style="font-size: 10pt; color: navy"><fileset</span><span style="font-size: 10pt; color: navy">dir=</span><span style="font-size: 10pt; color: green">"${report folder}"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">              </span><span style="font-size: 10pt; color: navy"><include </span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"TEST-*.xml"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">           </span><span style="font-size: 10pt; color: navy"></fileset></span></div> <div align="left"><span style="font-size: 10pt; color: black">           </span><span style="font-size: 10pt; color: navy"><report </span><span style="font-size: 10pt; color: navy">format=</span><span style="font-size: 10pt; color: green">"frames" </span><span style="font-size: 10pt; color: navy">todir=</span><span style="font-size: 10pt; color: green">"${report folder}"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"></junitreport></span></div> <div align="left"><span style="font-size: 10pt; color: black">    </span><span style="font-size: 10pt; color: navy"></target></span></div> <div align="left"><span style="font-size: 10pt; color: navy"></project></span></div> <div align="left"> </div> </td> </tr> </tbody> </table> <div> </div> <div>我们在eclipse中利用windows <span>-></span> show View <span>-></span> Ant 打开ant工作H口Q点?#8221;Add Buildfiles” 项目的根目录下的build.xmldq去Q然后在ant工作H口点运行图标,可以看到控制C的输出:(x)(当然Q用命o(h)行方式运行也可以)</div> <p><img style="width: 594px; height: 457px" height="457" alt="" src="http://p.blog.csdn.net/images/p_blog_csdn_net/lemonfamily/29ac98df6f2c4f2ba5f456677b7d8548.png" width="662" /></p> <div style="text-indent: 21.75pt"> </div> <div style="text-indent: 21.75pt">整个目~译成功Qƈ在项目根目录生成一个report文g夹,我们可以从中看到一份详l的试报告Q?/div> <div style="text-indent: 21.75pt"> </div> <p><img style="width: 607px; height: 459px" height="457" alt="" src="http://p.blog.csdn.net/images/p_blog_csdn_net/lemonfamily/59b24bb3f4504b3da4b497b21b7f3498.png" width="748" /></p> <div style="text-indent: 21.75pt"> </div> <div style="text-indent: 21.75pt">我们可能?x)希望junit 和ant为我们提供中文的试报告Q很遗憾的是Qantq没有给我们提供q个选项Q还好,ant可以让我们通过定义styledir属性,更改报告文g的输出样式的配置文gQ我们要做的Q就是汉化在ant安装文g夹中的junit-frames.xsl和junit-noframes.xslQ?也可以从<a >http://download.csdn.net/user/lemonfamily</a> 下蝲到该文g)甚至可以在里面定义一些我们需要的东西?/div> <div>Q可以参看:(x)<a >http://ant.apache.org/manual/OptionalTasks/junitreport.html</a>Q?/div> <div style="text-indent: 21.75pt"> </div> <table style="border-right: medium none; border-top: medium none; border-left: medium none; border-bottom: medium none; border-collapse: collapse" cellspacing="0" cellpadding="0" border="1"> <tbody> <tr> <td style="border-right: windowtext 1pt solid; padding-right: 5.4pt; border-top: windowtext 1pt solid; padding-left: 5.4pt; padding-bottom: 0cm; border-left: windowtext 1pt solid; width: 426.1pt; padding-top: 0cm; border-bottom: windowtext 1pt solid" valign="top" width="568"> <div align="left"><span style="font-size: 10pt; color: navy"><junitreport</span><span style="font-size: 10pt; color: navy">todir=</span><span style="font-size: 10pt; color: green">"${report folder}"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">           </span><span style="font-size: 10pt; color: navy"><fileset</span><span style="font-size: 10pt; color: navy">dir=</span><span style="font-size: 10pt; color: green">"${report folder}"</span><span style="font-size: 10pt; color: navy">></span></div> <div align="left"><span style="font-size: 10pt; color: black">              </span><span style="font-size: 10pt; color: navy"><include</span><span style="font-size: 10pt; color: navy">name=</span><span style="font-size: 10pt; color: green">"TEST-*.xml"</span><span style="font-size: 10pt; color: navy">/></span></div> <div align="left"><span style="font-size: 10pt; color: black">           </span><span style="font-size: 10pt; color: navy"></fileset></span></div> <div align="left"><span style="font-size: 10pt; color: black">           </span><span style="font-size: 10pt; color: navy"><report</span><span style="font-size: 10pt; color: navy">format=</span><span style="font-size: 10pt; color: green">"frames"</span><span style="font-size: 10pt; color: navy">todir=</span><span style="font-size: 10pt; color: green">"${report folder}"</span><strong><span style="font-size: 10pt; color: red">styledir</span></strong><span style="font-size: 10pt; color: navy">=</span><span style="font-size: 10pt; color: green">"junitreport"</span><span style="font-size: 10pt; color: navy">/></span></div> <div><span style="font-size: 10pt; color: black">       </span><span style="font-size: 10pt; color: navy"></junitreport></span></div> </td> </tr> </tbody> </table> <div style="text-indent: 21.75pt"> </div> <div>q是更改后的效果Q?/div> <div> </div> <p><img style="width: 584px; height: 456px" height="456" alt="" src="http://p.blog.csdn.net/images/p_blog_csdn_net/lemonfamily/9033d935e0a146598d848ba579d7d78f.png" width="678" /></p> <div> </div> <div>     现在我们已经可以做到试代码和开发代码分开Qƈ利用ant的自动编译功能ؓ(f)我们执行试计划和生成测试报告。虽然在~写试案例的时候确实比较麻烦,我们需要详l的模拟实际应用中的环境QƈL可能出现错误的边界值帮助我们在~写实际代码时尽量减隐(zhn)的发生Q往往~写试案例的时间比我们~写实际代码的时间还长,但这样做是非常值得的,一个Y件的开发周期最长的60%都是花在L错误和完善的q程中?/div> <img src ="http://www.aygfsteel.com/zhangzhong1018/aggbug/142411.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/zhangzhong1018/" target="_blank">leoli</a> 2007-09-03 18:00 <a href="http://www.aygfsteel.com/zhangzhong1018/articles/142411.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <a href="http://www.aygfsteel.com/" title="狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频">狠狠久久亚洲欧美专区_中文字幕亚洲综合久久202_国产精品亚洲第五区在线_日本免费网站视频</a> </div> </footer> վ֩ģ壺 <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ӱ</a>| <a href="http://" target="_blank">ľ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ͬ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ɽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">ƽ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">Ͽ</a>| <a href="http://" target="_blank">ͬ</a>| <a href="http://" target="_blank">ϼ</a>| <a href="http://" target="_blank">Դ</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̫</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank">̳</a>| <a href="http://" target="_blank">²</a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <a href="http://" target="_blank"></a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>