51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 3284|回复: 4
打印 上一主题 下一主题

selenium+JUint+Ant运行成功但没有测试结果

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2011-5-30 18:30:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
这个是我的代码
<?xml version="1.0" encoding="UTF-8"?>
<project name = "Testcase" default = "init">

<!-- 指定JUnit类库的位置 -->
   <property name = "junitJar" value = "lib/junit.jar"/>
   <target name = "init">
         <mkdir dir = "report"/>
         <mkdir dir = "htmlreport"/>
    </target>
   
<!-- //编译源文件 -->
    <target name = "compile">
          <javac destdir = "src" srcdir = "src" includeantruntime="on">
               <classpath>
                     <pathelement location = "${junitJar}"/>
               </classpath>
          </javac>
     </target>

<!-- //执行JUnit测试 -->
     <target name = "run" depends = "compile">
          <echo message = "start run Junit test"/>
          <junit>
                <classpath>
                      <pathelement location = "src"/>
                      <pathelement location = "${junitJar}"/>
                </classpath>
                <romatter type = "xml"/>
                <batchtest haltonfailure = "no" todir = "report">
                      <fileset dir = "src">
                           <include name = "**/*Test.java"/>
                      </fileset>
                </batchtest>
          </junit>
   

<!--//生成html报表 -->
     <junitReport todir = "./htmlreport">
           <fileset dir = "./report">
             <include name = "TEST-*.xml"/>
           </fileset>
          <report format = "noframes" todir = "./htmlreport"/>
     </junitReport>
     <echo message = "end running junit test"/>
   
     </target>
   </project>
         

   执行后,显示如下结果
Buildfile: C:\Documents and Settings\ccxopen\workspace\Anttest\build.xml
init:
BUILD SUCCESSFUL
Total time: 67 milliseconds           


也就是只执行了init 这个target,complie和run都没有执行,为什么呢,谁能跟我说一下吗
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2011-5-31 16:23:54 | 只看该作者
<project name = "Testcase" default = "init">

把default设成你最后一个target 的name,然后各个target之间用depends = "" 连起来
回复 支持 反对

使用道具 举报

该用户从未签到

3#
 楼主| 发表于 2011-6-1 11:59:58 | 只看该作者
回复 2# robin.von


    不行啊。。编译可以通过,但没有run。。
回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2011-6-1 13:18:40 | 只看该作者
回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2011-7-27 12:06:09 | 只看该作者
本帖最后由 yangl326 于 2011-7-27 14:18 编辑

project name = "Testcase" default = "init"

只执行了init 标签   默认为执行init  target  


<!-- //编译源文件 -->
    <target name = "compile">
          <javac destdir = "src" srcdir = "src" includeantruntime="on">
               <classpath>
                     <pathelement location = "${junitJar}"/>
               </classpath>
          </javac>
     </target>
改成

<!-- //编译源文件 -->
    <target name = "compile" depends=“init”>
          <javac destdir = "src" srcdir = "src" includeantruntime="on">
               <classpath>
                     <pathelement location = "${junitJar}"/>
               </classpath>
          </javac>
     </target>

加上  depends=“init”

project中 把default 执行的 init改成run

这样ant执行标签顺序是
默认执行run的时候
run依赖compile  就先执行compile
compile依赖 init 就先执行init

即执行target顺序  init->compile->run

楼主可以查询下ant中target标签的depends属性
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-5-12 01:46 , Processed in 0.077462 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表