background preloader

Testing

Facebook Twitter

Rollbar - Error Tracking Software for Ruby, Python, JavaScript, more. Pytest-nodev — test-driven code search. Testing Flask Applications — Flask Documentation (0.10) Something that is untested is broken.

Testing Flask Applications — Flask Documentation (0.10)

The origin of this quote is unknown and while it is not entirely correct, it is also not far from the truth. Untested applications make it hard to improve existing code and developers of untested applications tend to become pretty paranoid. If an application has automated tests, you can safely make changes and instantly know if anything breaks. Flask provides a way to test your application by exposing the Werkzeug test Client and handling the context locals for you. You can then use that with your favourite testing solution. The Application First, we need an application to test; we will use the application from the Tutorial.

The Testing Skeleton. Pytest documentation. Good Integration Practises. Work with virtual environments We recommend to use virtualenv environments and use pip (or easy_install) for installing your application and any dependencies as well as the pytest package itself.

Good Integration Practises

This way you will get an isolated and reproducible environment. Given you have installed virtualenv and execute it from the command line, here is an example session for unix or windows: virtualenv . # create a virtualenv directory in the current directory source bin/activate # on unix scripts/activate # on Windows We can now install pytest: Due to the activate step above the pip will come from the virtualenv directory and install any package into the isolated virtual environment. Choosing a test layout / import rules pytest supports two common test layouts: Important notes relating to both schemes: make sure that “mypkg” is importable, for example by typing once:pip install -e . # install package using setup.py in editable modeavoid “__init__.py” files in your test directories. Note If you now type: FitNesse. FitNesse is a web server, a wiki, and an automated testing tool for software.

FitNesse

It is based on Ward Cunningham's Framework for Integrated Test. FitNesse is designed to support acceptance testing rather than unit testing in that it facilitates detailed readable description of system function. FitNesse allows users of a developed system to enter specially formatted input (its format is accessible to non-programmers). This input is interpreted and tests are created automatically. These tests are then executed by the system and output is returned to the user. Principles of FitNesse[edit] FitNesse as a testing method[edit] FitNesse was originally designed as a highly usable interface around the Fit framework. FitNesse testing is based around the notion of black-box testing, in which a system under test is considered to be a black box and is tested in terms of the outputs generated in response to predetermined inputs.

Introduction — Lettuce v0.1rc11 (barium release) documentation. Lets begin to describe and solve our problem... first round [a] describe behaviour Start describing the expected behaviour of factorial in zero.feature using English: Feature: Compute factorial In order to play with Lettuce As beginners We’ll implement factorial Scenario: Factorial of 0 Given I have the number 0 When I compute its factorial Then I see the number 1 Note.

introduction — Lettuce v0.1rc11 (barium release) documentation

Garybernhardt/expecter. Tl;dw: Speedily practical large-scale tests. At PyCon 2012, Erik Rose gave a talk entitled, Speedily Practical Large-Scale Tests.

tl;dw: Speedily practical large-scale tests

This is my textual summary of the talk, one of a series of summaries. Here's the video of Erik: For those in too much of a hurry to even read the text here, the tl;dr: Slow test suites are usually slow due to I/O. Erik reduced test fixture I/O by moving fixture setup and teardown to the class instead of the tests, by rearranging classes to reuse fixtures, and by removing fixtures in favor of constructed objects. This was a long (40 minute) talk, and Erik covered a number of points, I hope I captured it. I work at Mozilla, we have lots of large web services to keep running, some with 30 billion requests a month.

First I'll cover how to make the tests fast, then how to keep them maintainable, then how to make them as informative as possible. The sumo project has really clean code, but the tests are really slow. Plone.testing 4.0.7. Testing infrastructure for Zope and Plone projects.

plone.testing 4.0.7

To use plone.testing in your own package, you need to add it as a dependency. Most people prefer to keep test-only dependencies separate, so that they do not need to be installed in scenarios (such as on a production server) where the tests will not be run. This can be achieved using a test extra. In setup.py, add or modify the extras_require option, like so: Pytest - rapid and simple testing with Python. TestingToolsTaxonomy. Join the Testing In Python (TIP) mailing list for Python testing tools discussions!

TestingToolsTaxonomy

This wiki page is originated from PyCheeseCake and it was originally created by Grig Gheorghiu Unit Testing Tools The following tools are not currently being developed or maintained as far as we can see. They are here for completeness, with last activity date and an indication of what documentation there is. If you know better, please edit. Mock Testing Tools See also here for a side-by-side syntax comparison between some of the more popular tools in this space.

Unittest

Testing Tools for Python - Doug Hellmann. Test Driven Development and Test Automation are all the rage, and Python developers have no shortage of tools for testing their own applications.

Testing Tools for Python - Doug Hellmann

This month I am starting a series of columns on tools for developing in Python. I intend to cover areas such as version control, utility modules, build, and packaging tools. Eventually I may even work up the courage to address the issue of editors and IDEs while, I hope, avoiding a religious war. But let’s start out by looking at tools for testing your libraries and applications.

This isn’t a comprehensive survey, but it should give you some idea of the kinds of tools available.