接口测试(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命令

 

转载于:https://www.cnblogs.com/smlxs/p/7501065.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值