好几天没写了,抽时间写下,也好有个总结:

1.selenium+testNG+Ant

(1)ant 是构建工具 他的作用就是运行你配置好的东西 而tentng.xml你可以认为他是管理test的一个配置。在ant中配置运行testng 启动testng的时候 就会运行testng里面配置好的东西。

(2)eclipse 中给项目自动创建ant的build.xml文件

Eclipse 自动生成 Ant的Build.xml 配置文件,生成的方法很隐蔽 选择你要生成Build.xml文件的项目,右键. Export-> General -> Ant Buildfiles .点Next,再点Finish.生成完毕.

(3)

 1 Buildfile: D:\myFile\file\eclispe.work\aista\build.xml
2 build-subprojects:
3 init:
4 build-project:
5 [echo] aista: D:\myFile\file\eclispe.work\aista\build.xml
6 [javac] D:\myFile\file\eclispe.work\aista\build.xml:123: warning: 'includeantruntime' was not set, defaulting to
7
8 build.sysclasspath=last; set to false for repeatable builds
9 [javac] D:\myFile\file\eclispe.work\aista\build.xml:127: warning: 'includeantruntime' was not set, defaulting to
10
11 build.sysclasspath=last; set to false for repeatable builds
12 [javac] D:\myFile\file\eclispe.work\aista\build.xml:132: warning: 'includeantruntime' was not set, defaulting to
13
14 build.sysclasspath=last; set to false for repeatable builds
15 [javac] D:\myFile\file\eclispe.work\aista\build.xml:136: warning: 'includeantruntime' was not set, defaulting to
16
17 build.sysclasspath=last; set to false for repeatable builds
18 build:
19 BUILD SUCCESSFUL
20 Total time: 575 milliseconds

解决:<javac srcdir="${build.src}" destdir="${build.dest}">

改为<javac srcdir="${build.src}" destdir="${build.dest}" includeantruntime="on"/>

(4)配置Ant的build.xml文件:eclipse Target "build" does not exist in the project

<project name="AntExample" default="secondTarget" basedir=".">
     这个里面的default设定了默认执行的目标,也就是dos下执行ant命令不加参数时,会默认执行default中设定的目标
     你的default是secondTarget但是这里:
        <targle name="secondTargle">
               <echo>${secondText}</echo>
        </targle>
     name是secondTargle和上面default中设置的不一样,只要设为一样就行了

(5)

Buildfile: D:\myFile\file\eclispe.work\sysframe-normal-test\build.xml
init:
compile:
[echo] compile tests
run_tests:
[echo] running tests
[echo] D:\myFile\file\eclispe.work\sysframe-normal-test\classes
[testng] java.lang.NoClassDefFoundError: com/beust/jcommander/ParameterException
[testng] at java.lang.Class.getDeclaredMethods0(Native Method)
[testng] at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
[testng] at java.lang.Class.getMethod0(Class.java:2694)
[testng] at java.lang.Class.getMethod(Class.java:1622)
[testng] at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
[testng] at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
[testng] Caused by: java.lang.ClassNotFoundException: com.beust.jcommander.ParameterException
[testng] at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
[testng] at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
[testng] at java.security.AccessController.doPrivileged(Native Method)
[testng] at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
[testng] at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
[testng] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[testng] at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
[testng] ... 6 more
[testng] Exception in thread "main"
[testng] The tests failed.
transform:
[xslt] Processing D:\myFile\file\eclispe.work\sysframe-normal-test\lib\testng-results.xml to D:\myFile\file \eclispe.work\sysframe-normal-test\test-output\Report.html
[xslt] Loading stylesheet D:\myFile\file\eclispe.work\sysframe-normal-test\lib\testng-results.xsl
BUILD SUCCESSFUL
Total time: 2 seconds

发现testNG.jar的版本不对

selenium+testNG+Ant的更多相关文章

  1. 也谈自动化平台的搭建,另附高大上的名字---无人值守定时巡检系统(selenium+testng+ant+jenkins)

    最近公司新项目改版,由于没有运维,开发则负责上线任务,并且都是手动上线,并行的项目多了,分支混乱,经常导致B项目上线覆盖A项目,导致系统不定时出现异常,老板知道了便扣了大家的绩效,作为测试这边必须想个 ...

  2. selenium+testng+ant+jenkins 手记

    会不会搭建测试平台是一般测试工程师和高级测试工程师分水岭 ----tobecrazy 我们项目有现成的测试平台,使用的是selenium grid+testng+ant+jenkins+VM 但是我平 ...

  3. 我的自动化测试历程(Selenium+TestNG+Java+ReportNG+Jenkins)

    原地址:http://blog.csdn.net/shilinjie_8952/article/details/53380373?locationNum=11&fps=1 测试环境:Java+ ...

  4. Selenium2.0+TestNG+Ant+Jenkins自动化测试浅尝

    当前常用自动化测试工具 Web自动化测试工具:QTP .selenium等 性能自动化测试工具:loadrunner.jmeter等 接口自动化测试工具:SoapUI.postman等 手机自动化测试 ...

  5. Selenium 我的自动化测试历程 (Selenium+TestNG+Java+ReportNG+Jenkins)

    测试环境:Java+Selenium+TestNG,Jenkins持续集成. 测试代码 代码结构 采用页面对象模型(Page Object),减少UI修改后,对代码的影响.   Java编写,采用Te ...

  6. Selenium+TestNG+Maven(2)

    转载自http://www.cnblogs.com/hustar0102/p/5885115.html selenium介绍和环境搭建 一.简单介绍 1.selenium:Selenium是一个用于W ...

  7. 【Selenium-WebDriver自学】Selenium TestNG(十四)

    ==================================================================================================== ...

  8. Java+Selenium+Testng自动化测试学习(二)

    Java+Selenium+TestNG自动化测试框架整合 1.简化代码 封装一个定位元素的类,类型为ElementLocation package com.test; import org.open ...

  9. selenium+testng+reportng+ant+jenkins集成日记

    1.新建一个项目 2.编写测试脚本 3.配置ant的build.xml脚本 4.集成到jenkins,并运行 1.新建项目   注意jdk的版本要一致 eclipse  Window --Prefer ...

随机推荐

  1. kindeditor-4.1.10 结合 Asp.Net MVC 添加图片功能

    KindEditor是一套开源的HTML可视化编辑器,现在我要结合Asp.Net MVC4 上传图片功能,做相应的配置和修改, 其实网上也有人写过类似的文章了,我写出来是以防以后使用的时候出现这样的问 ...

  2. Why are very few schools involved in deep learning research? Why are they still hooked on to Bayesian methods?

    Why are very few schools involved in deep learning research? Why are they still hooked on to Bayesia ...

  3. Unity3d + NGUI 的多分辨率适配(黑边)

    原地址:http://www.2cto.com/kf/201310/250921.html 一.当下移动设备的主流分辨率(数据来自“腾讯分析移动设备屏幕分辨率分析报告”) 1.1 iOS设备的分辨率主 ...

  4. request重定向或者是response转发请求后面的代码依然执行

    调用response.redirect(),或者request.getRequestDispatcher(loginAddr).forward(request,response);后,后面的代码照样执 ...

  5. Android:安卓资源引用符号的含义

    @代表引用资源 @*代表引用系统的非public资源,如: @*android:color/white @[package:]type/name引用自定义资源,如: android:text=&quo ...

  6. MyEclipse常用设置笔记

    1. Myeclipse下去掉SVN用户名和密码,就只能删除Subversion的auth目录 windows平台 Win7: 1.进入c:/Users/[你的用户名]/AppData/Roaming ...

  7. 【HDOJ】4343 Interval query

    最大不相交集合的数量.思路是dp[i][j]表示已经有i个不相交集合下一个不相交集合的最右边界.离散化后,通过贪心解. /* 4343 */ #include <iostream> #in ...

  8. 新版本的tlplayer for android ,TigerLeapMC for windows发布了

    tlplayer for android 新版本修正了图像倾斜等等问题,增加了动态水印功能. 支持hls(m3u8),http,rtsp,mms,rtmp等网络协议. 声明tlplayer 上的变速不 ...

  9. 查看Linux系统的版本以及位数

    1.查看版本 http://jingyan.baidu.com/article/215817f7e360bd1edb142362.html[root@localhost usr]# lsb_relea ...

  10. Java之iterator迭代器和iterable接口

    java.lang.Iterable java.util.Iterator Iterator是迭代器类,而Iterable是接口. 好多类都实现了Iterable接口,这样对象就可以调用iterato ...