Conteúdo
Em processo de tradução. Sinta-se à vontade para traduzir os trechos inacabados.
Entre para a lista de discussões sobre Testing In Python TDD (Test-Driven-Development) em Python para esclarecer suas dúvidas sobre as ferramentas abaixo.
Testes Unitários (Unit Testing)
Ferramenta |
Categoria |
Autor |
Parte de |
Descrição |
unit testing |
primeiro framework para testes unitários a ser incluída na biblioteca padrão da linguagem Python; fácil de usar por pessoas familiarizadas com os frameworks xUnit; suporte para organização dos testes e reuso via suites de testes |
|||
unit testing |
copy and paste output from shell session; "Agile Documentation": unit tests themselves can serve as documentation when combined with epydoc; also see Django's approach |
|||
unit testing |
no API!;automatic collection of tests; simple asserts; strong support for test fixture/state management via setup/teardown hooks; strong debugging support via customized traceback |
|||
unittest extensions |
|
unittest enhancements; test filtering via regex/glob patterns; reporting in XML/HTML; colorized output; runs pdb on failing tests; run in parallel in threads/processes; verbose asserts; report failures immediately; and a little more; |
||
unittest extensions |
|
unit test framework, used most notably by TurboGears; provides an alternate test discovery and running process for unittest, one that is intended to mimic the behavior of py.test as much as is reasonably possible without resorting to too much magic. More friendly with unittest.TestCase-based tests than py.test. |
||
unittest extensions |
Extension of unittest to support writing asynchronous unit tests using Deferreds and new result types ('skip' and 'todo'). Includes a command-line program that does test discovery and integrates with doctest and coverage. |
|||
unittest extensions |
|
Transparently adds support for running unittest test cases/suites in a separate process: prevents system wide changes by a test destabilising the test runner. It also allows reporting from tests in another process into the unittest framework, giving a single integrated test environment. |
||
unittest extensions |
|
Provides a mechanism for managing 'resources' - expensive bits of infrastructure - that are needed by multiple tests. Resources are constructed and free on demand, but with an optional TestSuite, the test run order is optimised to reduce the number of resource constructions and releases needed. Compatible with unittest. |
||
unit testing |
Sancho 2.1 runs tests, and provides output for tests that fail; Sancho 2.1 does not count tests passed or failed; targets projects that do not maintain failing tests |
|||
performance-based unit testing |
|
port of JUnitPerf; transparently adds performance testing capabilities to existing unitttest-based test suites |
||
specification-based unit testing |
|
like the unittest module, except that test methods may take arguments; you declare each argument with a default value which names a test-data generator and the peckcheck module will peck at your test methods with a bunch of generated values |
||
unit testing |
|
Easy-to-use (PyQt) GUI framework and application for use with the Python unit testing framework. It can be used to conveniently execute unit tests and suites, and then display the results in a useful fashion. |
||
unit testing |
|
A manly test runner; command-line and curses(3) interfaces; the iPod of test runners. (More seriously, makes it easier to browse and inspect your test failures) |
||
unit testing |
Zope3 community |
|
Powerful test runner that includes support for post-mortem debugging of test failures. Also includes profiling and coverage reporting. This is a standalone package that has no dependencies on Zope and works just fine with projects that don't use Zope. |
Ferramentas para "Mock Test"
Tool |
Category |
Author |
Claim to fame |
mock testing |
Python Mock enables the easy creation of mock objects that can be used to emulate the behaviour of any class that the code under test depends on. You can set up expectations about the calls that are made to the mock object, and examine the history of calls made. This makes it easier to unit test classes in isolation. Download it here. |
||
mock testing |
PyMock is based on the Java easymock package. It uses a recording and replay model rather than using a specification language. Easymock lives up to its name compared to other mocking packages. PyMock takes advantage of python's dynamic nature for futher improvements. |
||
mock testing |
Graham Carlyle |
Inspired by the Java jMock library, pMock makes the writing of unit tests using mock object techniques easier |
|
mock testing |
Embeds mock testing constructs inside doctest tests. |
||
mock testing |
enables easier testing of Python programs that make use of Subversion's Python bindings |
||
stub testing |
Stubble allows you to write arbitrary classes for use as stubs instead of read classes while testing. Stubble lets you link a stub class loosely to the real class which it is a stub for. This information is then used to ensure that tests will break if there is a discrepancy between the interface supported by your stub class and that of the real class it stands in for. |
Fuzz Testing Tools
According to Wikipedia, "fuzz testing" (or "fuzzing") is a software testing technique whose basic idea is to attach the inputs of a program to a source of random data ("fuzz"). If the program fails (for example, by crashing, or by failing built-in code assertions), then there are defects to correct. The great advantage of fuzz testing is that the test design is extremely simple, and free of preconceptions about system behavior.
Tool |
Author |
Claim to fame |
Ivan Moore |
Tests your tests by mutating source code and finding tests that don't fail! |
|
Michael Eddington |
Peach can fuzz just about anything from .NET, COM/ActiveX, SQL, shared libraries/DLL's, network applications, web, you name it. |
|
dmckinney |
The purpose of antiparser is to provide an API that can be used to model network protocols and file formats by their composite data types. Once a model has been created, the antiparser has various methods for creating random sets of data that deviates in ways that will ideally trigger software bugs or security vulnerabilities. |
|
rodrigomarcos |
Taof is a GUI cross-platform Python generic network protocol fuzzer. It has been designed for minimizing set-up time during fuzzing sessions and it is specially useful for fast testing of proprietary or undocumented protocols. |
Web Testing Tools
First, let's define some categories of Web testing tools:
Browser simulation tools: simulate browsers by implementing the HTTP request/response protocol and by parsing the resulting HTML
Browser automation tools: automate browsers by driving them for example via COM calls in the case of Internet Explorer, or XPCOM in the case of Mozilla
In-process or unit-test-type tools (definition courtesy of Ian Bicking): call an application in the same process, instead of generating an HTTP request; so an exception in the application would go all the way up to the command runner (py.test, unittest, etc).
Tool |
Category |
Author |
Part of |
Claim to fame |
Browser simulation & In-process |
offers simple commands for navigating Web pages, posting forms and asserting conditions; can be used as shell script or Python module; can be used for unit-testing your own Web app; stress-test functionality; port of PBP; uses John J. Lee's mechanize |
|||
Browser simulation |
HTTP, HTTPS, GET, POST, basic auth all handled; control over expected status codes; uses unittest as the underlying framework |
|||
Browser simulation |
Benoit Delbosc / Nuxeo |
functional/performance/load/stress testing for Web applications; easy test creation using TCPWatch as proxy recorder; reporting capabilities; based on webunit |
||
Browser simulation |
designed to be used in doctests that mirror user actions (see the README.txt for examples); can also be used as standalone Web testing tool outside of Zope 3 |
|||
Browser simulation |
extensions to unittest for web frameworks; uses http://docs.python.org/lib/module-httplib.html httplib] |
|||
Browser automation |
Robert Marchetti |
automates Internet Explorer by manipulating IE's Document Object Model via COM |
||
Browser automation |
provides Python XPCOM bindings for automating Mozilla browsers |
|||
In-process |
lets you test your WSGI applications without a server; similar in feel to zope.testbrowser |
In-process |
very simple and small testing framework for Django applications, based on the ideas of the Ruby on Rails testing framework; fully based on unittest, so you don't need anything beside Django and Python to make use of it |
|||
In-process |
testing framwework for Django applications; built on top of doctest instead of unittest; fixtures are written in YAML not Python code; implemented simple request/response tests on top of Beautiful Soup |
Note: Although not a Python-specific testing tool, Selenium is nevertheless an important addition to any tester's arsenal. It relates to Python in that it can use a Twisted-based server to run tests against Web applications. Read a tutorial about it, followed by a quick update. With make_selenium.py script you can write Selenium tests in Python.
Acceptance/Business Logic Testing Tools
Tool |
Author |
Claim to fame |
John Roth |
port of FIT; supports both FIT and FitNesse; acceptance tests for business logic written as HTML or Wiki tables |
|
Geoff Bache |
works by comparing plain text logged by programs with a previous 'gold standard' version of that text; the tool itself is written in Python but it can be used to test programs written in any language; comes with extensive self tests which serve as examples of how to use it, i.e. how to test a non-trivial application with a pyGTK GUI. |
|
Ian Bicking |
A (rather alpha-ish) library for loading tests from Excel or CSV files; not really a framework, but useful for acceptance tests written by non-programmers |
GUI Testing Tools
Tool |
Author |
Claim to fame |
Python helper library for testing Python GUI applications, with pyGTK support being the most mature |
||
aims to be a gui unittesting library for python; initially provided solely for PyQt, but it may be extended in the future |
||
Created by Redhat engineers on linux. Uses the X11 accessability framework (AT-SPI) to drive applications so works well with the gnome desktop on Unixes. Has flash movies |
||
Also uses the X11 accessability framework (AT-SPI) to drive applications so works well with the gnome desktop on Unixes. Has extensive tests for the evolution groupware client. |
||
Mark McMahon |
Simple Windows (NT/2K/XP) GUI automation with Python. There are tests included for Localization testing but there is no limitation to this. Most of the code at the moment is for recovering information from Windows windows and performing actions on those controls. The idea is to have high level methods for standard controls rather then rely on Sending keystrokes to the applications. |
|
pyAA is an object oriented Python wrapper around the client-side functionality in the Microsoft Active Accessibility (MSAA) library. MSAA is a library for the Windows platform that allows client applications inspect, control, and monitor events and controls in graphical user interfaces (GUIs) and server applications to expose runtime information about their user interfaces. See the User interface automation with pyAA tutorial for more info. |
||
Dr Tim Couper |
Windows Application Test System Using Python - another Windows GUI automation tool. |
|
Simon Brunning |
Low-level library for Windows GUI automation used by PAMIE and WATSUP. |
|
Johan Dahlin |
PyGTK UI Testing framework, recording and playback system. |
Source Code Checking Tools
Tool |
Author |
Claim to fame |
finds problems that are typically caught by a compiler for less dynamic languages; imports each module before checking it |
||
Sylvain Thénault / Logilab |
includes PyChecker checks, plus more features, like checking line-code's length, checking if variable names are well-formed according to your coding standard, or checking if declared interfaces are truly implemented |
|
Phil Frost / Divmod |
similar to PyChecker; focused on identifying common errors quickly without executing Python code; its primary advantage over PyChecker is that it is fast: it runs on most large projects in only a few seconds |
Code Coverage Tools
Tool |
Author |
Claim to fame |
measures code coverage during Python execution; uses the code analysis tools and tracing hooks provided in the Python standard library to determine which lines are executable, and which have been executed |
|| figleaf || Titus Brown || figleaf is a Python code coverage analysis tool, built somewhat on the model of Ned Batchelder's fantastic coverage module. The goals of figleaf are to be a minimal replacement of 'coverage.py' that supports more configurable coverage gathering and reporting; figleaf is useful for situations where you are recording code coverage in multiple execution ru