Franklin

Python testing [electronic resource] : beginner's guide : an easy and convenient approach to testing your Python projects / Daniel Arbuckle.

Author/Creator:
Arbuckle, Daniel.
Edition:
1st edition
Publication:
Birmingham, U.K. : Packt Pub., 2010.
Format/Description:
Book
1 online resource (256 p.)
Subjects:
Python (Computer program language)
Form/Genre:
Electronic books.
Language:
English
System Details:
text file
Summary:
The book begins with the very foundations of automated testing, and expands on them until the best-practice tools and techniques are fully covered. New concepts are illustrated with step-by-step hands-on exercises. Testing will be easier and more enjoyable with this beginner's guide. If you are a Python developer and want to write tests for your applications, this book will get you started and show you the easiest way to learn testing. You need to have sound Python programming knowledge to follow along. An awareness of software testing would be good, but no formal knowledge of testing is expec
Contents:
Cover; Copyright; Credits; About the Author; About the Reviewers; Table of Contents; Preface; Chapter 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; Chapter 2: Doctest: The Easiest Testing Tool; Basic doctest; Time for action - creating and running your first doctest; The syntax of doctests; Time for action - writing a more complex test; Expecting exceptions; Time for action - expecting an exception; Expecting blank lines in the output; Using directives to control doctest
Ignoring part of the resultTime for action - using ellipsis in tests; Ignoring whitespace; Time for action - normalizing whitespace; Skipping an example entirely; Time for action - skipping tests; Other doctest directives; Execution scope; Embedding doctests in Python docstrings; Time for action - embedding a doctest in a docstring; 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
Chapter 3: Unit Testing with DoctestWhat is Unit testing and what it is not?; Time for action - identifying units; Unit testing throughout the development process; Design phase; Time for action - unit testing during design; Development phase; Time for action - unit testing during development; Feedback phase; Time for action - unit testing during feedback; Back to the development phase; Time for action - unit testing during development... again; Maintenance phase; Time for action - unit testing during maintenance; Reuse phase; Time for action - unit testing during reuse; Summary
Chapter 4: Breaking Tight Coupling by using Mock ObjectsInstalling Python Mocker; Time for action - installing Python Mocker; The idea of a mock object; Python Mocker; Time for action - exploring the basics of Mocker; Mocking functions; Mocking containers; Parameter matching; ANY; ARGS; KWARGS; IS; IN; CONTAINS; MATCH; Mocking complex expressions; Returning iterators; Raising exceptions; Calling functions via a mock; Specifying that an expectation should occur multiple times; Replacing library objects with mocks; Mocking self; Time for action - passing a mock object as self; Summary
Chapter 5: When Doctest isn't Enough: Unittest to the RescueBasic unittest; Time for action - testing PID with unittest; Assertions; assertTrue; assertFalse; assertEqual; assertNotEqual; assertAlmostEqual; assertNotAlmostEqual; assertRaises; fail; Test fixtures; Time for action - testing database-backed units; Integrating with Python Mocker; Summary; Chapter 6: Running Your Tests: Follow Your Nose; What is Nose?; Installing Nose; Organizing tests; Time for action - organizing tests from previous chapters; Finding doctests; Customizing Nose's search; Nose and doctest
Time for action - creating a fixture for a doctest
Notes:
Includes index.
ISBN:
1-282-50182-8
9786612501821
1-84719-885-6
OCLC:
828793022
Loading...
Location Notes Your Loan Policy
Description Status Barcode Your Loan Policy