TestNG是什么

到这里,大家肯定已经运行了一些关于Selenium的测试用例了(这里主要是站着一个自动化测试工程师的角度来看待TestNG的,所以这里所说的也都是基于Web测试的验证点来说的,而不是针对单元测试来说。这里就涉及到了Selenium),也产生了相应的格式的测试输出结果了。现在我们将学习一下怎样利用TestNG这个测试框架将测试结果报告显示出来。

TestNG和Junit一样都是一种测试框架,不过它克服了Junit存在的一些局限性。NG意味着"Next Generation".大部分的Selenium测试工程师都选择TestNG而非Junit就是因为TestNG的优势。在TestNG中出现了更多的功能相对于Junit来说,但是在这里我们只关注在Selenium测试中应用比较多的功能。

TestNG VS Junit

TestNG相对于JUnit有三点主要的优势:

  • 注释更容易理解
  • 测试用例能以组的概念出现会显得更简单
  • 并行测试成为可能

Installing TestNG in Eclipse

步骤1

  • Launch Eclipse.
  • On the menu bar, click Help.
  • Choose the "Install New Software..." option.

Step 2

In the Install dialog box, click the Add button

Step 3

  1. In "Name", type TestNG.
  2. In "Location", type http://beust.com/eclipse.
  3. Click OK

Step 4

  • Notice that "TestNG - http://beust.com/eclipse" was populated onto the "Work with:" textbox.
  • Check the "TestNG" check box as shown below, then click Next.
  • Note: In the latest Eclipse (Kepler) you don't have a checkbox for testNG, instead you click on question mark (help) icon which will open up the form, and you can select all and installation will continue as for the remaining instructions. Thanks Jana for the tip!

Step 5

  • Click Next again on the succeeding dialog box until you reach the License Agreement dialog.
  • Click "I accept the terms of the license agreement" then click Finish.

Step 6

Wait for the installation to finish

If you encounter a Security warning, just click OK

Step 7

When Eclipse prompts you for a restart, just click Yes.

Step 8

After restart, verify if TestNG was indeed successfully installed. Click Window > Preferences and see if TestNG is included on the Preferences list.

Step9

We will now start to import the TestNG Libraries onto our project. Click on the "Libraries" tab, and then "Add Library…"

Step 10

On the Add Library dialog, choose "TestNG" and click Next.

Step 11

Click Finish.

You should notice that TestNG is included on the Libraries list.

Step 12

We will now add the JAR files that contain the Selenium API. These files are found in the Java client driver that we downloaded from http://docs.seleniumhq.org/download/ when we were installing Selenium and Eclipse in the previous chapters.

TestNG简单介绍以及安装—学习笔记1的更多相关文章

  1. 路由其实也可以很简单-------Asp.net WebAPI学习笔记(一) ASP.NET WebApi技术从入门到实战演练 C#面向服务WebService从入门到精通 DataTable与List<T>相互转换

    路由其实也可以很简单-------Asp.net WebAPI学习笔记(一)   MVC也好,WebAPI也好,据我所知,有部分人是因为复杂的路由,而不想去学的.曾经见过一位程序猿,在他MVC程序中, ...

  2. Linux系统Vi/Vim编辑器的简单介绍、安装/卸载、常用命令

    Linux系统Vi/Vim编辑器的简单介绍.安装/卸载.常用命令 1.介绍 vi(Visual Interface)编辑器是Linux和Unix上最基本的文本编辑器,工作在字符模式下.由于不需要图形界 ...

  3. CocoaPods的简单介绍及安装和使用

    CocoaPods的简单介绍及安装和使用   一.CocoaPods是什么? 当你开发iOS应用时,会常常使用到非常多第三方开源类库.比方JSONKit.AFNetWorking等等. 可能某个类库又 ...

  4. openresty开发系列10--openresty的简单介绍及安装

    openresty开发系列10--openresty的简单介绍及安装 一.Nginx优点 十几年前,互联网没有这么火,软件外包开发,信息化建设,帮助企业做无纸化办公,收银系统,工厂erp,c/s架构偏 ...

  5. Nessus简单介绍与安装

    1.Nessus简单介绍与安装 1.Nessus简介 Nessus号称是世界上最流行的漏洞扫描程序,全世界有超过75000个组织在使用它.该工具提供完整的电脑漏洞扫描服务,并随时更新其漏洞数据库.Ne ...

  6. Mahout学习之Mahout简单介绍、安装、配置、入门程序測试

    一.Mahout简单介绍 查了Mahout的中文意思--驭象的人,再看看Mahout的logo,好吧,想和小黄象happy地玩耍,得顺便陪陪这位驭象人耍耍了... 附logo: (就是他,骑在象头上的 ...

  7. MongoDB(1)--简单介绍以及安装

    前段时间接触了NoSql类型的数据库redis,当时是作为缓存server使用的.那么从这篇博客開始学习还有一个非常出名的NoSql数据库:MongoDb.只是眼下还没有在开发其中使用.一步一步来吧. ...

  8. Kurento应用开发指南(以Kurento 5.0为模板) 之中的一个:简单介绍,安装与卸载

    文件夹 1. Kurento是什么               3 2. Kurento简单介绍                       3 2.1 WebRTC媒体server         ...

  9. Cloudera impala简单介绍及安装具体解释

    一.Impala简单介绍 Cloudera Impala对你存储在Apache Hadoop在HDFS,HBase的数据提供直接查询互动的SQL.除了像Hive使用同样的统一存储平台,Impala也使 ...

随机推荐

  1. 离线安装Cloudera Manager 5和CDH5(最新版5.9.3) 完全教程(二)基础环境安装

    一.安装CentOS 6.5 x64 具体安装过程自行百度 1.1 修改IP地址 [root@master ~]# vi /etc/sysconfig/network DEVICE=eth0 TYPE ...

  2. Linux命令——磁盘管理

    Linux命令--磁盘管理 命令df 作用:查看已挂载磁盘的总容量.使用容量.剩余容量等 参数:-i,查看inodes的使用状况 参数:-h,使用合适的单位显示(推荐) 命令du 作用:查看某个目录或 ...

  3. 🈲Eclipse通过jdbc连接数据库制作简单登陆界面【新手必看】

    一.前言: 做网站开发,要求有多种搭配方式,前台技术可以使用PHP.ASP.JSP.ASP.NET.CGI等任何一种: 需要用到的基础语言用的最多的就是HTML/CSS.JS.JAVA.XML这些了, ...

  4. Linux下安装与配置snmp服务

    一.安装snmp服务 1.检查系统是否已经安装snmp的rpm包 以下是安装snmp服务需要的rpm包: libsensors3-2.10.6-55.el5.i386.rpm lm_sensors-2 ...

  5. Docker实战(二)之操作Docker容器

    容器是Docker的另外一个核心概念.简单来说,容器是镜像的一个运行实例.所不同的是,镜像是静态的只读文件,而容器带有运行时需要的可写文件层.如果认为虚拟机是模拟运行的一整套操作系统系统(包括内核,应 ...

  6. leetcode 26—Remove Duplicates from Sorted Array

    Given a sorted array nums, remove the duplicates in-place such that each element appear only once an ...

  7. MVC 在action拦截器中获取当前进入的控制器和aciton名

    我们在实现了action拦截器以后(继承至System.Web.Mvc.IActionFilter),需要在重写的方法OnActionExecuting中去获得当前进入的控制器和action名称,如何 ...

  8. 几个PHP读取整个文件的函数readfile()、fpassthru()和file()

    2.7.4   读取整个文件:readfile().fpassthru()和file()除了可以每次读取文件一行外,还可以一次读取整个文件.PHP提供了4种不同的方式来读取整个文件.第一种方式是rea ...

  9. CS190.1x-ML_lab4_ctr_student

    这次lab主要主要是研究click-through rate (CTR).数据集来自于Kaggle的Criteo Labs dataset.相关ipynb文件见我github. 作业分成5个部分:on ...

  10. [CF1063F]String Journey[后缀数组+线段树]

    题意 在 \(S\) 中找出 \(t\) 个子串满足 \(t_{i+1}\) 是 \(t_{i}\) 的子串,要让 \(t\) 最大. \(|S| \leq 5\times 10^5\). 分析 定义 ...