• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
A生命练习生
博客园    首页    新随笔    联系   管理    订阅  订阅

接口测试(java+testng+ant+jenkins)第三篇ant

1、ant是什么?

  是一个将软件编译、测试、部署等步骤联系在一起加以自动化的一个工具

2、下载安装

  http://www.cnblogs.com/yuzhongwusan/archive/2013/03/26/2982411.html

3、在eclipce中的使用

准备工作:

  项目右键——new——folder——folder name: lib

  将testng-6.8.5.jar 、jcommander.jar 放入lib

  项目右键——new——file——build.xml  (文件名不能写错)

  放入代码

<?xml version="1.0"  encoding="UTF-8" ?>
<project name="HelloWorld" default="regression" basedir=".">
<property name="src" value="src"/>
<property name="dest" value="classes"/>
<property name="testng.dir"  value="${basedir}\lib"/>
<property name="testng.output.dir" value="${basedir}\test-output"/>


 <path id="class1">
        <fileset dir="${basedir}\lib" includes="*jar"/>
        <pathelement location="${dest}"/>
        <pathelement location="${src}"/>
 </path>

<taskdef resource="testngtasks" classpath="${testng.dir}/testng-6.8.5.jar"/>

<target name="init">
    <delete dir="${dest}"/>
    <mkdir dir="${dest}"/>
</target>
<target name="compile" depends="init">
   <javac srcdir="${src}" destdir="${dest}"  classpathref="class1" encoding="UTF8" includeantruntime="off" debug="on" debuglevel="lines,vars,source"/>
</target>

<target name="regression" depends="compile">
        <echo>running testng</echo>
        <testng outputdir="${testng.output.dir}" classpathref="class1" delegateCommandSystemProperties="true">
            <xmlfileset dir="${basedir}" includes="testng.xml"/>
        </testng>
</target>
</project>

4、运行build.xml

  可以右键Run As——Ant build

  也可以用cmd进入build.xml所在目录,使用ant命令

 

posted @ 2017-09-10 14:47  A生命练习生  阅读(691)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3