testNG安装与使用
1、Eclipse集成TestNG插件
a.下载TestNG离线插件并解压得到features和plugins两个文件夹;
b.将features文件下的org.testng.eclipse_6.9.8.201510130443复制到D:\eclipse\features目录下;
c.将plugins文件下的org.testng.eclipse_6.9.8.201510130443复制到D:\eclipse\plugins目录下;
注:重启Eclipse,windows=》preferences=》TestNG
2、导入testNG依赖包
a.进入maven中央仓库地址:https://mvnrepository.com/

b.Maven项目下的pom.xml配置
<dependencies>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
<scope>test</scope>
</dependency>
</dependencies>
3.配置完成,新建TestNGDemo01类



4.为了方便访问,也可以将testng.xml 拖动至项目根目录下:

5.运行套件执行类可以在这么配置

6.TestNGDemo01示例代码
package cn.xiaobing.testng; import org.testng.annotations.Test;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.AfterSuite; public class TestNGDemo01 {
@Test(dataProvider = "dp")
public void f(Integer n, String s) {
System.out.println("TestNGDemo01.f()");
}
@BeforeMethod
public void beforeMethod() {
System.out.println("TestNGDemo01.beforeMethod()");
} @AfterMethod
public void afterMethod() {
System.out.println("TestNGDemo01.afterMethod()");
} @DataProvider
public Object[][] dp() {
System.out.println("数据提供者:@DataProvider");
return new Object[][] {
new Object[] { 1, "a" },
new Object[] { 2, "b" },
};
}
@BeforeClass
public void beforeClass() {
System.out.println("TestNGDemo01.beforeClass()");
} @AfterClass
public void afterClass() {
System.out.println("TestNGDemo01.afterClass()");
} @BeforeTest
public void beforeTest() {
System.out.println("TestNGDemo01.beforeTest()");
} @AfterTest
public void afterTest() {
System.out.println("TestNGDemo01.afterTest()");
} @BeforeSuite
public void beforeSuite() {
System.out.println("TestNGDemo01.beforeSuite()");
} @AfterSuite
public void afterSuite() {
System.out.println("TestNGDemo01.afterSuite()");
} }
7.执行套件:

8.输出结果:


总结:亲测后总结,分享给需要的人,不足之处后续修正补充!
testNG安装与使用的更多相关文章
- 2.4 【配置环境】TestNG安装
两种方法可以安装TestNG Eclipse插件: (来源:http://blog.csdn.net/hongchangfirst/article/details/7679849/) 第一种,离线安 ...
- TestNG安装及使用
安装:https://www.cnblogs.com/xusweeter/p/6559196.html使用:https://www.cnblogs.com/liwu/p/5113936.html 作用 ...
- testNG安装一直失败解决方法
1.在eclipse界面选择“Help”--"Eclipse Marketplace"中进行查找TestNG 然后进“install” (成功) 2.在eclipse界面选择“He ...
- Selenium之TestNG安装
一.在Eclipse中安装TestNG 1.打开eclipse-->help-->Install New Software-->Add,输入Name和Location后,点击OK. ...
- TestNG安装及配置
1. 在idea中新建一个maven项目 2. 在pom.xml中添加testng和reportng依赖 <dependencies> <!-- 添加testNG依赖 --> ...
- Eclipse安装TestNG
1.在Eclipse中点击Help菜单,选择Install New Software选项,在弹出页面中输入安装地址即可安装. http://beust.com/eclipse 2. 3. 4. 等待T ...
- TestNG的安装和使用
一.TestNG安装 打开这个网址:https://marketplace.eclipse.org/content/testng-eclipse#group-external-install-butt ...
- testNG的安装
1,testNG介绍 TestNG ( Testing Next Generation ,下一代测试技术) testNG的强大之处在于它是 利用注释(注解) 来强化测试功能的测试框架,可以用来做接口测 ...
- JAVA+Maven+TestNG搭建接口测试框架及实例
1.配置JDK 见另一篇博客:http://www.cnblogs.com/testlurunxiu/p/5933912.html 2.安装Eclipse以及TestNG Eclipse下载地址:ht ...
随机推荐
- javascript 数组 shuffle 洗牌 打乱顺序
* php shuffle 打乱数组顺序 Array.prototype.shuffle = function () { "use strict"; var a = [], b = ...
- bug 找不到或无法加载主类main.java.*
开发时遇到的的一个问题,不知道是什么引起的,一个maven springboot 的项目,主类启动的时候报错,说没找到 主类,起先怀疑是springboot的问题,随手写一个单独的类,有main方法, ...
- Markdown 相关语法
MD语法博客:https://www.cnblogs.com/Jetictors/p/8506757.html 公式 \[\mathbf{x}_{t}=\Phi_{t}\left(\mathbf{x} ...
- 智汀家庭云-开发指南Golang:设备场景
场景是指通过SA实现设备联动.例如,自动检测今天的天气情况,今天无雨,定时智能音箱播放浇花提醒,并且播报今天的天气情况. 根据自身需求,把多种控制并发的事情编辑成一个场景,并命名,可以通过场景控制很多 ...
- 题解 Hero meet devil
题目传送门 题目大意 给出一个长度为 \(n\) 的字符串,对于每个 \(k\in [0,n]\),求出有多少个长度为 \(m\) 的字符串满足两者最长公共子序列长度为 \(k\). \(n\le 1 ...
- Java(46)类加载器
作者:季沐测试笔记 原文地址:https://www.cnblogs.com/testero/p/15201673.html 博客主页:https://www.cnblogs.com/testero ...
- 初探JavaScript PDF blob转换为Word docx方法
PDF转WORD为什么是历史难题 PDF 转Word 是一个非常非常普遍的需求,可谓人人忌危,为什么如此普遍的需求,却如此难行呢,还得看为什么会有这样的一个需求: PDF文档遵循iOS32000的规范 ...
- TCP 粘包 - 拆包问题及解决方案
目录 TCP粘包拆包问题 什么是粘包 - 拆包问题 为什么存在粘包 - 拆包问题 粘包 - 拆包 演示 粘包 - 拆包 解决方案 方式一: 固定缓冲区大小 方式二: 封装请求协议 方式三: 特殊字符结 ...
- ZK(ZooKeeper)分布式锁实现
点赞再看,养成习惯,微信搜索[牧小农]关注我获取更多资讯,风里雨里,小农等你. 本文中案例都会在上传到git上,请放心浏览 git地址:https://github.com/muxiaonong/Zo ...
- 【UE4 调试】C++ 常见编译 warnnings/errors
error LNK2019: unresolved external symbol "" referenced in function 描述 Link错误.无法解析的外部符号 解决 ...