首页 技术 正文
技术 2022年11月15日
0 收藏 803 点赞 4,152 浏览 1844 个字

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.

TestNG简单介绍以及安装—学习笔记1

Step 2

In the Install dialog box, click the Add button

TestNG简单介绍以及安装—学习笔记1

Step 3

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

TestNG简单介绍以及安装—学习笔记1

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!

TestNG简单介绍以及安装—学习笔记1

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.

TestNG简单介绍以及安装—学习笔记1

Step 6

Wait for the installation to finish

TestNG简单介绍以及安装—学习笔记1

If you encounter a Security warning, just click OK

TestNG简单介绍以及安装—学习笔记1

Step 7

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

TestNG简单介绍以及安装—学习笔记1

Step 8

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

TestNG简单介绍以及安装—学习笔记1

Step9

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

TestNG简单介绍以及安装—学习笔记1

Step 10

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

TestNG简单介绍以及安装—学习笔记1

Step 11

Click Finish.

TestNG简单介绍以及安装—学习笔记1

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

TestNG简单介绍以及安装—学习笔记1

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

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,071
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,549
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,397
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,174
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,809
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,889