zoukankan      html  css  js  c++  java
  • TestNG简单介绍以及安装—学习笔记1

    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.

  • 相关阅读:
    asp.net中virtual和abstract的区别分析
    .NET中的Timer类型用法详解
    类型参数的约束(C# 编程指南)T
    SELECT INTO 和 INSERT INTO SELECT 两种表复制语句
    jquery的$.extend和$.fn.extend作用及区别
    类型参数约束 : Controller where T : class,new()
    asp.net获取当前网址url的各种属性(文件名、参数、域名 等)的代码
    字符串一级指针的内存模型图(盲点,以前自己懵懂)
    字符串的基本操作,初始化和赋值之类的区别,和数据名是一个常量指针不可以改变和赋值(盲点众多)
    关于内存四区和指针的修改问题
  • 原文地址:https://www.cnblogs.com/taoSir/p/4816114.html
Copyright © 2011-2022 走看看