Amazon cover image
Image from Amazon.com

Learning Python testing : a straightforward and easy approach to testing your Python projects / Daniel Arbuckle.

By: Material type: TextTextSeries: Community experience distilledPublisher: Birmingham, UK : Packt Publishing, 2014Edition: Second editionDescription: 1 online resource (1 volume) : illustrationsContent type:
  • text
Media type:
  • computer
Carrier type:
  • online resource
ISBN:
  • 9781783553228
  • 1783553227
  • 1783553219
  • 9781783553211
Subject(s): Genre/Form: Additional physical formats: Print version:: Learning Python Testing.DDC classification:
  • 004.6186
LOC classification:
  • QA76.73.P98
Online resources:
Contents:
Cover; Copyright; Credits; About the Author; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Python and Testing; Testing for fun and profit; Levels of testing; Unit testing; Integration testing; System testing; Acceptance testing; Regression testing; Test-driven development; You'll need Python; Summary; Chapter 2: Working with doctest; Where doctest performs best; The doctest language; Example -- creating and running a simple doctest; Result -- three times three does not equal ten; The syntax of doctests; Example -- a more complex test; Result -- five tests run?
Expecting exceptionsExample -- checking for an exception; Result -- success at failing; Expecting blank lines; Controlling doctest behavior with directives; Ignoring part of the result; Example -- ellipsis test drive; Result -- ellipsis elides; Ignoring white space; Example -- invoking normality; Result -- white space matches any other white space; Skipping an example; Example -- humans only; Result -- it looks like a test, but it's not; The other directives; The execution scope of doctest tests; Check your understanding; Exercise -- English to doctest; Embedding doctests into docstrings.
Example -- a doctest in a docstringResult -- the code is now self-documenting and self-testable; Putting it into practice -- an AVL tree; English specification; Node data; Testing the constructor; Recalculating height; Making a node deletable; Rotation; Locating a node; The rest of the specification; Summary; Chapter 3: Unit Testing with doctest; What is unit testing?; The limitations of unit testing; Example -- identifying units; Choosing units; Check your understanding; Unit testing during the development process; Design; Development; Feedback; Development, again; Later stages of the process.
The basicsAssertions; The assertTrue method; The assertFalse method; The assertEqual method; The assertNotEqual method; The assertAlmostEqual method; The assertNotAlmostEqual method; The assertIs and assertIsNot methods; The assertIsNone and assertIsNotNone methods; The assertIn and assertNotIn methods; The assertIsInstance and assertNotIsInstance methods; The assertRaises method; The fail method; Make sure you get it; Test fixtures; Example -- testing database-backed units; Summary; Chapter 6: Running Your Tests with Nose; Installing Nose; Organizing tests; An example of organizing tests.
Summary: Chapter 4: Decoupling Units with unittest.mock; Mock objects in general; Mock objects according to unittest.mock; Standard mock objects; Non-mock attributes; Non-mock return values and raising exceptions; Mocking class or function details; Mocking function or method side effects; Mocking containers and objects with a special behavior; Mock objects for properties and descriptors; Mocking file objects; Replacing real code with mock objects; Mock objects in action; Better PID tests; Patching time.time; Decoupling from the constructor; Summary; Chapter 5: Structured Testing with unittest.Summary: This book is ideal if you want to learn about the testing disciplines and automated testing tools from a hands-on, conversational guide. You should already know Python and be comfortable with Python 3.
Item type:
Tags from this library: No tags from this library for this title. Log in to add tags.
Star ratings
    Average rating: 0.0 (0 votes)
Holdings
Item type Home library Collection Call number Materials specified Status Date due Barcode
Electronic-Books Electronic-Books OPJGU Sonepat- Campus E-Books EBSCO Available

Online resource; title from cover (Safari, viewed December 18, 2014).

Includes index.

Cover; Copyright; Credits; About the Author; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Python and Testing; Testing for fun and profit; Levels of testing; Unit testing; Integration testing; System testing; Acceptance testing; Regression testing; Test-driven development; You'll need Python; Summary; Chapter 2: Working with doctest; Where doctest performs best; The doctest language; Example -- creating and running a simple doctest; Result -- three times three does not equal ten; The syntax of doctests; Example -- a more complex test; Result -- five tests run?

Expecting exceptionsExample -- checking for an exception; Result -- success at failing; Expecting blank lines; Controlling doctest behavior with directives; Ignoring part of the result; Example -- ellipsis test drive; Result -- ellipsis elides; Ignoring white space; Example -- invoking normality; Result -- white space matches any other white space; Skipping an example; Example -- humans only; Result -- it looks like a test, but it's not; The other directives; The execution scope of doctest tests; Check your understanding; Exercise -- English to doctest; Embedding doctests into docstrings.

Example -- a doctest in a docstringResult -- the code is now self-documenting and self-testable; Putting it into practice -- an AVL tree; English specification; Node data; Testing the constructor; Recalculating height; Making a node deletable; Rotation; Locating a node; The rest of the specification; Summary; Chapter 3: Unit Testing with doctest; What is unit testing?; The limitations of unit testing; Example -- identifying units; Choosing units; Check your understanding; Unit testing during the development process; Design; Development; Feedback; Development, again; Later stages of the process.

The basicsAssertions; The assertTrue method; The assertFalse method; The assertEqual method; The assertNotEqual method; The assertAlmostEqual method; The assertNotAlmostEqual method; The assertIs and assertIsNot methods; The assertIsNone and assertIsNotNone methods; The assertIn and assertNotIn methods; The assertIsInstance and assertNotIsInstance methods; The assertRaises method; The fail method; Make sure you get it; Test fixtures; Example -- testing database-backed units; Summary; Chapter 6: Running Your Tests with Nose; Installing Nose; Organizing tests; An example of organizing tests.

Chapter 4: Decoupling Units with unittest.mock; Mock objects in general; Mock objects according to unittest.mock; Standard mock objects; Non-mock attributes; Non-mock return values and raising exceptions; Mocking class or function details; Mocking function or method side effects; Mocking containers and objects with a special behavior; Mock objects for properties and descriptors; Mocking file objects; Replacing real code with mock objects; Mock objects in action; Better PID tests; Patching time.time; Decoupling from the constructor; Summary; Chapter 5: Structured Testing with unittest.

This book is ideal if you want to learn about the testing disciplines and automated testing tools from a hands-on, conversational guide. You should already know Python and be comfortable with Python 3.

eBooks on EBSCOhost EBSCO eBook Subscription Academic Collection - Worldwide

There are no comments on this title.

to post a comment.

O.P. Jindal Global University, Sonepat-Narela Road, Sonepat, Haryana (India) - 131001

Send your feedback to glus@jgu.edu.in

Hosted, Implemented & Customized by: BestBookBuddies   |   Maintained by: Global Library