1. 我们先从几个基本的、偏底层的自动化测试框架开始
- JUnit
A programmer-oriented testing framework for Java. JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.
- NUnit
NUnit is a unit-testing framework for all .Net languages. Initially ported from JUnit.
- unittest(PyUnit)
The Python unit testing framework, sometimes referred to as “PyUnit,” is a Python language version of JUnit, by Kent Beck and Erich Gamma. JUnit is, in turn, a Java version of Kent’s Smalltalk testing framework. Each is the de facto standard unit testing framework for its respective language.
Unittest supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework. The unittest module provides classes that make it easy to support these qualities for a set of tests.
2. 下面介绍几个High-Level的自动化测试框架
- ROBOT
The Robot Framework is a generic test automation framework for acceptance testing and acceptance test-driven development (ATDD). It is a keyword-driven testing framework that uses tabular test data syntax.
The framework is written using the Python. Test cases are written using keyword testing methodology written in a tabular format. These tables can be written in plain text, HTML, tab-separated values (TSV), or reStructuredText (reST) formats files in any text editor or using the Robot Integrated Development Environment (RIDE).
The following test case implements a Hello World example:
Log | Hello World |
Log
is a built-in keyword that logs the given parameter to the test report generated by the Robot Framework.
With the help of the SeleniumLibrary, writing tests for web applications is very easy too:
Open Browser | http://www.google.com | ie |
Input Text | id=lst-ib | Robot Framework |
Click Button | Google Search |
This test opens a new Internet Explorer browser window and performs an internet search.
- TestNG
TestNG is a unit testing framework for the Java programming language inspired from JUnit and NUnit. The design goal of TestNG is to cover all categories of tests: unit, functional, end-to-end, integration, etc., with more powerful and easy-to-use functionalities.
- White
White is a framework for automating rich client applications based on Win32, WinForms, WPF, Silverlight and SWT (Java) platforms. It is .NET based and does not require the use of any proprietary scripting languages. Tests/automation programs using White can be written with whatever .NET language, IDE and tools you are already using. White provides a consistent object-oriented API, hiding the complexity of Microsoft's UIAutomation library (on which White is based) and windows messages.
- QTP
HP Unified Functional Testing software, formerly known as QuickTest Professional and HP QuickTest Professional. HP Unified Functional Testing supports keyword and scripting interfaces and features a graphical user interface. It uses the Visual Basic Scripting Edition (VBScript) scripting language to specify a test procedure, and to manipulate the objects and controls of the application under test.
It performs functional and regression testing through a user interface such as a native GUI or web interface.
QTP supports record and playback. Action is the fundmental element in QTP's test case.
3. 自动化测试工具
- Selenium
Selenium is a portable software testing framework for web applications which contains serveral tools:
(1) Selenium IDE
It provides a record/playback tool for authoring tests without learning a test scripting language
(2) Selenium 1(aka. Selenium RC or Remote Control)
Selenium RC was the main Selenium project for a long time, before the WebDriver/Selenium merge brought up Selenium 2, the newest and more powerful tool. The backend of Selenium RC uses a Javascript library to drive interactions with the page. The disadvantage is the limitation of Javascript, for example, Selenium RC can't handle popup windows.
(3) Selenium 2(aka. Selenium Webdriver)
WebDriver project began with the aim to develop a testing tool that spoke directly to the browser using the ‘native’ method for the browser and operating system, thus avoiding the restrictions of a sandboxed Javascript environment.
4. 性能测试
- LoadRunner
LoadRunner is an automated performance and test automation product from HP for application load testing: examining system behaviour and performance, while generating actual load.