Log In
Or create an account -> 
Imperial Library
  • Home
  • About
  • News
  • Upload
  • Forum
  • Help
  • Login/SignUp

Index
Python Testing Beginner's Guide
Table of Contents Python Testing Credits About the Author About the Reviewers Preface
What this book covers What you need for this book Who this book is for Conventions Time for action – heading
What just happened? Pop quiz – heading Have a go hero – heading
Reader feedback Customer support
Errata Piracy Questions
1. Testing for Fun and Profit
How can testing help? Types of testing
Unit testing Integration testing System testing
You've got Python, right? Summary
2. Doctest: The Easiest Testing Tool
Basic doctest Time for action – creating and running your first doctest
What just happened? The syntax of doctests
Time for action – writing a more complex test
What just happened? Expecting exceptions
Time for action – expecting an exception
What just happened? Expecting blank lines in the output Using directives to control doctest
Ignoring part of the result
Time for action – using ellipsis in tests
What just happened?
Ignoring whitespace
Time for action – normalizing whitespace
Skipping an example entirely
Time for action – skipping tests
What just happened?
Other doctest directives
Execution scope Pop quiz – doctest syntax Have a go hero – from English to doctest
Embedding doctests in Python docstrings Time for action – embedding a doctest in a docstring
What just happened? Doctest directives Execution scope
Putting it in practice: an AVL tree
English specification Node data Constructor Recalculate height Make deletable Rotation Locating a node Testing the rest of the specification
Summary
3. Unit Testing with Doctest
What is Unit testing and what it is not? Time for action – identifying units
What just happened? Pop quiz – understanding units
Unit testing throughout the development process
Design phase
Time for action – unit testing during design
What just happened? Pop quiz – unit testing during design Have a go hero Development phase
Time for action – unit testing during development
What just happened? Feedback phase
Time for action – unit testing during feedback
What just happened? Back to the development phase
Time for action – unit testing during development... again
What just happened? Maintenance phase
Time for action – unit testing during maintenance
What just happened? Reuse phase
Time for action – unit testing during reuse
What just happened? Pop quiz – unit testing Have a go hero – test-driven development
Summary
4. Breaking Tight Coupling by using Mock Objects
Installing Python Mocker Time for action – installing Python Mocker The idea of a mock object Python Mocker Time for action – exploring the basics of Mocker
What just happened? Mocking functions Mocking containers Parameter matching
ANY ARGS KWARGS IS IN CONTAINS MATCH
Mocking complex expressions Have a go hero Returning iterators Raising exceptions Calling functions via a mock Specifying that an expectation should occur multiple times Replacing library objects with mocks Pop quiz – Mocker usage Have a go hero – mocking datetime
Mocking self Time for action – passing a mock object as self
What just happened?
Summary
5. When Doctest isn't Enough: Unittest to the Rescue
Basic unittest Time for action – testing PID with unittest
What just happened? Assertions
assertTrue assertFalse assertEqual assertNotEqual assertAlmostEqual assertNotAlmostEqual assertRaises fail
Pop quiz – basic unittest knowledge Have a go hero – translating into unittest
Test fixtures Time for action – testing database-backed units
What just happened? Pop quiz – test fixtures Have a go hero – file path abstraction
Integrating with Python Mocker Summary
6. Running Your Tests: Follow Your Nose
What is Nose? Installing Nose Organizing tests Time for action – organizing tests from previous chapters
What just happened? Finding doctests Customizing Nose's search Pop quiz – testing with Nose Have a go hero – nosing around
Nose and doctest Time for action – creating a fixture for a doctest Nose and unittest Time for action – creating a module fixture
What just happened?
Time for action – creating a package fixture
What just happened?
Nose's own testing framework Time for action – using Nose-specific tests
What just happened?
Summary
7. Developing a Test-Driven Project
Writing the specification Time for action – what are you going to do?
What just happened?
Writing initial unit tests Time for action – nailing down the specification with unit tests
What just happened?
Coding planner.data Using the tests to get the code right Fixing the code Time for action – writing and debugging code
What just happened?
Writing persistence tests Writing persistence code Finishing up
Pop quiz – test-driven development Have a go hero
Summary
8. Testing Web Application Frontends using Twill
Installing Twill Exploring the Twill language Time for action – browsing the web with Twill
What just happened?
Time for action – Twill scripting
What just happened? Twill commands
help setglobal setlocal add_auth add_extra_header clear_extra_headers show_extra_headers agent back clear_cookies code config debug echo exit extend_with find notfind follow formaction formclear formfile form value getinput getpassword go info save_cookies load_cookies show_cookies redirect_error redirect_output reset_error reset_output reload reset_browser run runfile save_html show showforms showhistory showlinks sleep submit tidy_ok title url
Pop quiz – the Twill language Have a go hero – browsing the web with Twill
Calling Twill scripts from tests Time for action – running Twill script files
What just happened?
Time for action – running Twill script strings
What just happened? A nifty trick
Integrating Twill operations into unittest tests Time for action – using Twill's browser object
What just happened? Browser methods
get_code get_html get_title get_url find_link follow_link get_all_forms get_form get_form_field clicked submit
Pop quiz – browser methods
Summary
9. Integration Testing and System Testing
Integration tests and system tests Time for action – figuring out the order of integration
What just happened? Pop quiz – diagramming integration Have a go hero – diagram your own program
Automation with doctest, unittest, and Nose Time for action – writing integration tests for the time planner
What just happened? Pop quiz – writing integration tests Have a go hero – integrating your own program
Summary
10. Other Testing Tools and Techniques
Code coverage
coverage.py
Time for action – using coverage.py
What just happened? Pop quiz – code coverage Have a go hero – checking coverage in earlier chapters
Version control hooks
Bazaar
Time for action – installing Nose as a Bazaar post-commit hook
What just happened? Mercurial
Time for action – installing Nose as a Mercurial post-commit hook
What just happened? Git
Time for action – installing Nose as a Git post-commit hook
What just happened? Darcs
Time for action – installing Nose as a Darcs post-record hook
What just happened? Subversion
Time for action – installing Nose as a Subversion post-commit hook
What just happened? Pop quiz – version control hooks
Automated continuous integration
Buildbot
Time for action – using Buildbot with Bazaar
What just happened? Pop quiz – Buildbot Have a go hero
Summary
A. Answers to Pop Quizes
Chapter 2
Pop quiz – doctest syntax
Chapter 3
Pop quiz – understanding units Pop quiz – unit testing during design Pop quiz – unit testing
Chapter 4
Pop quiz – Mocker usage
Chapter 5
Pop quiz – basic unittest knowledge Pop quiz – text fixtures
Chapter 6
Pop quiz – testing with Nose
Chapter 7
Pop quiz – test-driven development
Chapter 8
Pop quiz – the Twill language Pop quiz – browser methods
Chapter 9
Pop quiz – diagramming integration Pop quiz – writing integration tests
Chapter 10
Pop quiz – code coverage Pop quiz – version control hooks
Index
  • ← Prev
  • Back
  • Next →
  • ← Prev
  • Back
  • Next →

Chief Librarian: Las Zenow <zenow@riseup.net>
Fork the source code from gitlab
.

This is a mirror of the Tor onion service:
http://kx5thpx2olielkihfyo4jgjqfb7zx7wxr3sd4xzt26ochei4m6f7tayd.onion