Test-Driven Development with Python. Obey the Testing Goat. Using Django, Książki
[ Pobierz całość w formacie PDF ]
//-->Praise forTest-Driven Development with Python“In this book, Harry takes us on an adventure of discovery with Python and testing. It’s anexcellent book, fun to read and full of vital information. It has my highest recommendationsfor anyone interested in testing with Python, learning Django or wanting to use Selenium.Testing is essential for developer sanity and it’s a notoriously difficult field, full of trade-offs. Harry does a fantastic job of holding our attention whilst exploring real world testingpractices.”— Michael FoordPython Core Developer and Maintainer of unittest“This book is far more than an introduction to Test Driven Development—it’s a completebest-practices crash course, from start to finish, into modern web application developmentwith Python. Every web developer needs this book.”— Kenneth ReitzFellow at Python Software Foundation“Harry’s book is what we wish existed when we were learning Django. At a pace that’sachievable and yet delightfully challenging, it provides excellent instruction for Django andvarious test practices. The material on Selenium alone makes the book worth purchasing,but there’s so much more!”— Daniel and Audrey Roy Greenfieldauthors ofTwo Scoops of Django(Two Scoops Press)Test-Driven Development withPythonHarry PercivalTest-Driven Development with Pythonby Harry PercivalCopyright © 2014 Harry Percival. All rights reserved.Printed in the United States of America.Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions areinstitutional sales department: 800-998-9938 orcorporate@oreilly.com.Editor:Meghan BlanchetteProduction Editor:Kara EbrahimCopyeditor:Charles RoumeliotisProofreader:Gillian McGarveyJune 2014:First EditionIndexer:Wendy CatalanoCover Designer:Randy ComerInterior Designer:David FutatoIllustrator:Rebecca DemarestRevision History for the First Edition:2014-06-09:First releaseSeefor release details.Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’ReillyMedia, Inc.Test-Driven Development with Python,the image of a cashmere goat, and related trade dress aretrademarks of O’Reilly Media, Inc.Many of the designations used by manufacturers and sellers to distinguish their products are claimed astrademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademarkclaim, the designations have been printed in caps or initial caps.While every precaution has been taken in the preparation of this book, the publisher and authors assumeno responsibility for errors or omissions, or for damages resulting from the use of the information containedherein.ISBN: 978-1-449-36482-3[LSI]Table of ContentsPreface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xvPrerequisites and Assumptions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxiAcknowledgments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxviiPart I.The Basics of TDD and Django3681. Getting Django Set Up Using a Functional Test. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3Obey the Testing Goat! Do Nothing Until You Have a TestGetting Django Up and RunningStarting a Git Repository2. Extending Our Functional Test Using the unittest Module. . . . . . . . . . . . . . . . . . . . . . . . 13Using a Functional Test to Scope Out a Minimum Viable AppThe Python Standard Library’s unittest ModuleImplicit waitsCommitOur First Django App, and Our First Unit TestUnit Tests, and How They Differ from Functional TestsUnit Testing in DjangoDjango’s MVC, URLs, and View FunctionsAt Last! We Actually Write Some Application Code!urls.pyUnit Testing a ViewThe Unit-Test/Code Cycle13161818222223242627303136v3. Testing a Simple Home Page with Unit Tests. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214. What Are We Doing with All These Tests?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35Programming Is like Pulling a Bucket of Water up from a Well
[ Pobierz całość w formacie PDF ]