{"product_id":"testing-python-isbn-9781118901229","title":"Testing Python","description":"\u003cb\u003eFundamental testing methodologies applied to the popular Python language\u003c\/b\u003e  \u003cp\u003e\u003ci\u003eTesting Python; Applying Unit Testing, TDD, BDD and Acceptance Testing\u003c\/i\u003e is the most comprehensive book available on testing for one of the top software programming languages in the world. Python is a natural choice for new and experienced developers, and this hands-on resource is a much needed guide to enterprise-level testing development methodologies. The book will show you why Unit Testing and TDD can lead to cleaner, more flexible programs.\u003c\/p\u003e \u003cp\u003eUnit Testing and Test-Driven Development (TDD) are increasingly must-have skills for software developers, no matter what language they work in. In enterprise settings, it's critical for developers to ensure they always have working code, and that's what makes testing methodologies so attractive. This book will teach you the most widely used testing strategies and will introduce to you to still others, covering performance testing, continuous testing, and more.\u003c\/p\u003e \u003cul\u003e \u003cli\u003eLearn Unit Testing and TDD—important development methodologies that lie at the heart of Agile development\u003c\/li\u003e \u003cli\u003eEnhance your ability to work with Python to develop powerful, flexible applications with clean code\u003c\/li\u003e \u003cli\u003eDraw on the expertise of author David Sale, a leading UK developer and tech commentator\u003c\/li\u003e \u003cli\u003eGet ahead of the crowd by mastering the underappreciated world of Python testing\u003c\/li\u003e \u003c\/ul\u003e \u003cp\u003eKnowledge of software testing in Python could set you apart from Python developers using outmoded methodologies. Python is a natural fit for TDD and \u003ci\u003eTesting Python\u003c\/i\u003e is a must-read text for anyone who wants to develop expertise in Python programming.\u003c\/p\u003e  Introduction 1  \u003cp\u003e\u003cb\u003eCHAPTER 1 A History of Testing 5\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eYou Do Test, Don’t You? 7\u003c\/p\u003e \u003cp\u003eFundamentals and Best Practices 7\u003c\/p\u003e \u003cp\u003ePython Installation 8\u003c\/p\u003e \u003cp\u003eLinux 8\u003c\/p\u003e \u003cp\u003eMac 8\u003c\/p\u003e \u003cp\u003eWindows 8\u003c\/p\u003e \u003cp\u003ePip 9\u003c\/p\u003e \u003cp\u003eVirtualenv 9\u003c\/p\u003e \u003cp\u003eSource Control (SVN, Git) 10\u003c\/p\u003e \u003cp\u003eInteractive Development Environment (IDE) 11\u003c\/p\u003e \u003cp\u003eSummary 12\u003c\/p\u003e \u003cp\u003e\u003cb\u003eCHAPTER 2 Writing Unit Tests 15\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eWhat Is Unit Testing? 15\u003c\/p\u003e \u003cp\u003eWhat Should You Test? 17\u003c\/p\u003e \u003cp\u003eWriting Your First Unit Test 17\u003c\/p\u003e \u003cp\u003eChecking Values with the assertEquals Method 18\u003c\/p\u003e \u003cp\u003eChecking Exception Handling with assertRaises 20\u003c\/p\u003e \u003cp\u003eFollowing the PEP-8 Standard 22\u003c\/p\u003e \u003cp\u003eUnit Test Structure 23\u003c\/p\u003e \u003cp\u003eAdditional Unit Test Examples 24\u003c\/p\u003e \u003cp\u003eGetting Clever with assertRaises 24\u003c\/p\u003e \u003cp\u003eMaking Your Life Easier with setUp 25\u003c\/p\u003e \u003cp\u003eUseful Methods in Unit Testing 27\u003c\/p\u003e \u003cp\u003eassertEqual(x, y, msg=None) 27\u003c\/p\u003e \u003cp\u003eassertAlmostEqual(x, y, places=None, msg=None, delta=None) 27\u003c\/p\u003e \u003cp\u003eassertRaises(exception, method, arguments, msg=None) 28\u003c\/p\u003e \u003cp\u003eassertDictContainsSubset(expected, actual, msg=None) 28\u003c\/p\u003e \u003cp\u003eassertDictEqual(d1, d2, msg=None) 28\u003c\/p\u003e \u003cp\u003eassertTrue(expr, msg=None) 28\u003c\/p\u003e \u003cp\u003eassertFalse(expr, msg=None) 29\u003c\/p\u003e \u003cp\u003eassertGreater(a, b, msg=None) 29\u003c\/p\u003e \u003cp\u003eassertGreaterEqual(a, b, msg=None) 29\u003c\/p\u003e \u003cp\u003eassertIn(member, container, msg=None) 30\u003c\/p\u003e \u003cp\u003eassertIs(expr1, expr2) 30\u003c\/p\u003e \u003cp\u003eassertIsInstance(obj, class, msg=None) 30\u003c\/p\u003e \u003cp\u003eassertNotIsInstance(obj, class, msg=None) 30\u003c\/p\u003e \u003cp\u003eassertIsNone(obj, msg=None) 30\u003c\/p\u003e \u003cp\u003eassertIsNot(expr1, expr2, msg=None) 31\u003c\/p\u003e \u003cp\u003eassertIsNotNone(obj, msg=None) 31\u003c\/p\u003e \u003cp\u003eassertLess(a, b, msg=None) 31\u003c\/p\u003e \u003cp\u003eassertLessEqual(a, b, msg=None) 31\u003c\/p\u003e \u003cp\u003eassertItemsEqual(a, b, msg=None) 31\u003c\/p\u003e \u003cp\u003eassertRaises(excClass, callableObj, *args, **kwargs, msg=None) 32\u003c\/p\u003e \u003cp\u003eSummary 32\u003c\/p\u003e \u003cp\u003e\u003cb\u003eCHAPTER 3 Utilizing Unit Test Tools 33\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eUsing Python’s Nose 33\u003c\/p\u003e \u003cp\u003eInstalling Nose 34\u003c\/p\u003e \u003cp\u003eUsing Nose’s Best Features 35\u003c\/p\u003e \u003cp\u003eRunning Specifi c Test Files 35\u003c\/p\u003e \u003cp\u003eGetting More Detail with Verbose 35\u003c\/p\u003e \u003cp\u003eDebugging Support with PDB 36\u003c\/p\u003e \u003cp\u003eChecking Your Coverage 38\u003c\/p\u003e \u003cp\u003eColoring your tests with Rednose 39\u003c\/p\u003e \u003cp\u003ePyTest: An Alternative Test Runner 40\u003c\/p\u003e \u003cp\u003eInstalling PyTest 40\u003c\/p\u003e \u003cp\u003ePyTest’s Best Features 41\u003c\/p\u003e \u003cp\u003eRunning Specifi c Tests 41\u003c\/p\u003e \u003cp\u003eViewing Detail with Verbose and Summary 42\u003c\/p\u003e \u003cp\u003eDebugging with PDB 43\u003c\/p\u003e \u003cp\u003eChecking Your Coverage with PyTest 45\u003c\/p\u003e \u003cp\u003eChoosing Between Nose and PyTest 46\u003c\/p\u003e \u003cp\u003eMock and Patch Tricky Situations 46\u003c\/p\u003e \u003cp\u003eInstalling the Mock Library 47\u003c\/p\u003e \u003cp\u003eMocking a Class and Method Response 47\u003c\/p\u003e \u003cp\u003eWhen Mock Won’t Do, Patch! 50\u003c\/p\u003e \u003cp\u003eThe Requests Library 50\u003c\/p\u003e \u003cp\u003ePatch in Action 50\u003c\/p\u003e \u003cp\u003eAdvanced Mocking 52\u003c\/p\u003e \u003cp\u003eSummary 53\u003c\/p\u003e \u003cp\u003e\u003cb\u003eCHAPTER 4 Writing Testable Documentation 55\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eWriting Your First Doctest 56\u003c\/p\u003e \u003cp\u003eTh e Python Shell 56\u003c\/p\u003e \u003cp\u003eAdding Doctests to a Method 57\u003c\/p\u003e \u003cp\u003eRunning Your Doctests 58\u003c\/p\u003e \u003cp\u003eHandling Error Cases 59\u003c\/p\u003e \u003cp\u003eAdvanced Doctest Usage 61\u003c\/p\u003e \u003cp\u003eImproving Doctests with Nose Integration 62\u003c\/p\u003e \u003cp\u003eSummary 65\u003c\/p\u003e \u003cp\u003eResources 65\u003c\/p\u003e \u003cp\u003e\u003cb\u003eCHAPTER 5 Driving Your Development with Tests 67\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eAgile Development 67\u003c\/p\u003e \u003cp\u003eAdopting the Agile Process Now 68\u003c\/p\u003e \u003cp\u003eEthos of Test Driven Development 70\u003c\/p\u003e \u003cp\u003eAdvantages of Test Driven Development 72\u003c\/p\u003e \u003cp\u003ePing-Pong Programming 72\u003c\/p\u003e \u003cp\u003eTest Driving Your Problem 73\u003c\/p\u003e \u003cp\u003eWriting Your Failing Test 74\u003c\/p\u003e \u003cp\u003eMaking Your Test Pass 75\u003c\/p\u003e \u003cp\u003eDriving More Features with Tests 75\u003c\/p\u003e \u003cp\u003eWrapping Up the Task 77\u003c\/p\u003e \u003cp\u003eSummary 82\u003c\/p\u003e \u003cp\u003eResources 83\u003c\/p\u003e \u003cp\u003e\u003cb\u003eCHAPTER 6 Writing Acceptance Tests 85\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eWhat Is Acceptance Testing? 85\u003c\/p\u003e \u003cp\u003eAnatomy of an Acceptance Test 87\u003c\/p\u003e \u003cp\u003eUsing Gherkin Syntax 87\u003c\/p\u003e \u003cp\u003eTh e Magic Is in the Step File 88\u003c\/p\u003e \u003cp\u003eGoals of Acceptance Testing 89\u003c\/p\u003e \u003cp\u003eImplementing Developer and QA Collaboration 90\u003c\/p\u003e \u003cp\u003eLetting Behavior Drive Your Problem 90\u003c\/p\u003e \u003cp\u003eWriting Your Failing Acceptance Test 90\u003c\/p\u003e \u003cp\u003eDefining Your Steps 92\u003c\/p\u003e \u003cp\u003eImplementing Your Code 94\u003c\/p\u003e \u003cp\u003eDeveloping More of the Feature 95\u003c\/p\u003e \u003cp\u003ebank_apppy 96\u003c\/p\u003e \u003cp\u003eindexhtml 97\u003c\/p\u003e \u003cp\u003eDelivering the Finished Article 98\u003c\/p\u003e \u003cp\u003eAdvanced Acceptance Test Techniques 102\u003c\/p\u003e \u003cp\u003eScenario Outline 102\u003c\/p\u003e \u003cp\u003eTables of Data in Scenarios 103\u003c\/p\u003e \u003cp\u003eSummary 104\u003c\/p\u003e \u003cp\u003eResources 105\u003c\/p\u003e \u003cp\u003e\u003cb\u003eCHAPTER 7 Utilizing Acceptance Test Tools 107\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eCucumber: The Acceptance Test Standard 107\u003c\/p\u003e \u003cp\u003eLettuce in Detail 108\u003c\/p\u003e \u003cp\u003eTagging 108\u003c\/p\u003e \u003cp\u003eFail Fast 112\u003c\/p\u003e \u003cp\u003eNosetest Integration 114\u003c\/p\u003e \u003cp\u003eRobot: An Alternative Test Framework 115\u003c\/p\u003e \u003cp\u003eInstalling Robot 116\u003c\/p\u003e \u003cp\u003eWriting a Test Case 116\u003c\/p\u003e \u003cp\u003eImplementing Keywords 117\u003c\/p\u003e \u003cp\u003eRunning Robot Tests 119\u003c\/p\u003e \u003cp\u003eSummary 123\u003c\/p\u003e \u003cp\u003eResources 123\u003c\/p\u003e \u003cp\u003e\u003cb\u003eCHAPTER 8 Maximizing Your Code’s Performance 125\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eUnderstanding the Importance of Performance Testing 126\u003c\/p\u003e \u003cp\u003eJMeter and Python 126\u003c\/p\u003e \u003cp\u003eInstallation 127\u003c\/p\u003e \u003cp\u003eConfiguring Your Test Plans 128\u003c\/p\u003e \u003cp\u003eUtilizing Your Test Plans Effectively 135\u003c\/p\u003e \u003cp\u003eCode Profiling with cProfile 135\u003c\/p\u003e \u003cp\u003eRun a cProfile Session 136\u003c\/p\u003e \u003cp\u003eAnalyzing the cProfile Output 142\u003c\/p\u003e \u003cp\u003eSummary 144\u003c\/p\u003e \u003cp\u003eResources 144\u003c\/p\u003e \u003cp\u003e\u003cb\u003eCHAPTER 9 Looking After Your Lint 145\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eComing to Grips with Pylint 146\u003c\/p\u003e \u003cp\u003eInstalling Pylint 146\u003c\/p\u003e \u003cp\u003eUsing Pylint 146\u003c\/p\u003e \u003cp\u003eUnderstanding the Pylint Report 149\u003c\/p\u003e \u003cp\u003eThe Module Block 149\u003c\/p\u003e \u003cp\u003eThe Messages by Category Section 149\u003c\/p\u003e \u003cp\u003eThe Messages Section 150\u003c\/p\u003e \u003cp\u003eThe Code Evaluation Score 150\u003c\/p\u003e \u003cp\u003eThe Raw Metrics Section 150\u003c\/p\u003e \u003cp\u003eThe Statistics by Type Section 150\u003c\/p\u003e \u003cp\u003eCustomizing Pylint’s Output 150\u003c\/p\u003e \u003cp\u003eTelling Pylint to Ignore Errors 153\u003c\/p\u003e \u003cp\u003eCovering All Your Code with Unit Tests 154\u003c\/p\u003e \u003cp\u003eInstalling Coverage 155\u003c\/p\u003e \u003cp\u003eUsing Coverage 155\u003c\/p\u003e \u003cp\u003eAdvanced Coverage Options 157\u003c\/p\u003e \u003cp\u003eProducing an HTML\/XML Report 157\u003c\/p\u003e \u003cp\u003eSetting a Minimum Coverage Threshold 159\u003c\/p\u003e \u003cp\u003eRestricting Coverage to a Specific Package 159\u003c\/p\u003e \u003cp\u003eIgnoring Coverage 160\u003c\/p\u003e \u003cp\u003eSummary 161\u003c\/p\u003e \u003cp\u003eResources 162\u003c\/p\u003e \u003cp\u003e\u003cb\u003eCHAPTER 10 Automating Your Processes 163\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eBuild Paver Tasks 164\u003c\/p\u003e \u003cp\u003eInstalling Paver 164\u003c\/p\u003e \u003cp\u003eCreating a Paver Task 164\u003c\/p\u003e \u003cp\u003eExecuting Paver Tasks 165\u003c\/p\u003e \u003cp\u003eDefi ning a Default Build 166\u003c\/p\u003e \u003cp\u003eSetting Up Automated Builds 168\u003c\/p\u003e \u003cp\u003eInstalling Jenkins 169\u003c\/p\u003e \u003cp\u003eAdding Coverage and PyLint Reports 175\u003c\/p\u003e \u003cp\u003eGenerating a PyLint Report 175\u003c\/p\u003e \u003cp\u003eGenerating a Coverage Report 176\u003c\/p\u003e \u003cp\u003eMaking Your Build Status Highly Visible 176\u003c\/p\u003e \u003cp\u003eSummary 181\u003c\/p\u003e \u003cp\u003eResources 181\u003c\/p\u003e \u003cp\u003e\u003cb\u003eCHAPTER 11 Deploying Your Application 183\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eDeploying Your Application to Production 184\u003c\/p\u003e \u003cp\u003eCreating a Deployable Artifact 185\u003c\/p\u003e \u003cp\u003eDefining the Paver Tasks 185\u003c\/p\u003e \u003cp\u003eIncorporating Packaging into the Build 187\u003c\/p\u003e \u003cp\u003eEnabling Archiving on Jenkins 188\u003c\/p\u003e \u003cp\u003eQA Environment 189\u003c\/p\u003e \u003cp\u003eImplementing Stage and Production Environments 190\u003c\/p\u003e \u003cp\u003eImplementing a Cloud Deployment 191\u003c\/p\u003e \u003cp\u003eCreating a Heroku Account 192\u003c\/p\u003e \u003cp\u003eCreating a Small Application 193\u003c\/p\u003e \u003cp\u003eSetting up Git for Heroku 193\u003c\/p\u003e \u003cp\u003eDeploying the Application to Heroku 194\u003c\/p\u003e \u003cp\u003eSmoke Testing a Deployed Application 195\u003c\/p\u003e \u003cp\u003eExample Application Stack 196\u003c\/p\u003e \u003cp\u003eSmoke Test Scenarios 197\u003c\/p\u003e \u003cp\u003eImplementing Smoke Tests 198\u003c\/p\u003e \u003cp\u003eSummary 200\u003c\/p\u003e \u003cp\u003eResources 201\u003c\/p\u003e \u003cp\u003e\u003cb\u003eCHAPTER 12 The Future of Testing Python 203\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eStub the Solution 203\u003c\/p\u003e \u003cp\u003eMaking Deployment Natural 205\u003c\/p\u003e \u003cp\u003eAutomating (Nearly) Everything 206\u003c\/p\u003e \u003cp\u003eWorking in Public 207\u003c\/p\u003e \u003cp\u003eCollaborating on Step Definitions 208\u003c\/p\u003e \u003cp\u003eFinal Thoughts 209\u003c\/p\u003e \u003cp\u003eResources 210\u003c\/p\u003e \u003cp\u003eIndex 211\u003c\/p\u003e  \u003cp\u003e\u003cb\u003eDavid Sale\u003c\/b\u003e is currently a software developer for British Sky Broadcasting (BSkyB), where he works predominantly with Python and Java. He quickly began making his presence known in the Python Community, having written web articles on various Python topics. David has also given talks on Behaviour Driven Development and Agile Development at the EuroPython conference. He writes about technology for Nettuts+ and Tech.Pro.\u003c\/p\u003e  \u003cul\u003e \u003cli\u003eClearly defines testing fundamentals and best practices\u003c\/li\u003e \u003cli\u003eProvides comprehensive overview of unit testing methods\u003c\/li\u003e \u003cli\u003eExplains how to implement Test Driven Development\u003c\/li\u003e \u003cli\u003eCovers acceptance testing and tools needed to perform acceptance tests\u003c\/li\u003e \u003c\/ul\u003e \u003cp\u003e\u003cb\u003eApply Acceptance Testing, Test-Driven Development, Unit Testing, and Behavior-Driven Development to Python\u003c\/b\u003e\u003c\/p\u003e \u003cp\u003eUnit testing and test-driven development (TDD) are increasingly must-have skills for software developers, no matter what language they work in. In enterprise settings, it’s critical for developers to ensure they always have working code, and that’s what makes testing methodologies so attractive. More recently, behavior-driven development (BDD) has taken testing to a new level, and this book will introduce you to the practice and tools to take up this exciting modern style of testing your software. This book will teach you the most widely used testing strategies and will introduce to you to still others, covering performance testing, continuous testing, and more. Learn to:\u003c\/p\u003e \u003cul\u003e \u003cli\u003eGet your hands dirty with the basic building blocks in testing: unit tests\u003c\/li\u003e \u003cli\u003eEffectively embed unit tests in your doc strings and have them run as tests\u003c\/li\u003e \u003cli\u003eAdopt the concepts and ethos of test-driven development (TDD)\u003c\/li\u003e \u003cli\u003eDeploy smoke testing and get to grips with Pylint\u003c\/li\u003e \u003cli\u003eWrite and undertake acceptance testing with Cucumber, Lettuce, and Robot\u003c\/li\u003e \u003cli\u003eAnalyse and find problem areas within your code using JMeter and cProfile\u003c\/li\u003e \u003cli\u003eSuccessfully implement continuous integration\u003c\/li\u003e \u003c\/ul\u003e","brand":"Wiley","offers":[{"title":"Default Title","offer_id":47990145745125,"sku":"NP9781118901229","price":44.99,"currency_code":"USD","in_stock":false}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/1842\/7735\/files\/9781118901229.jpg?v=1761786677","url":"https:\/\/k12savings.com\/es\/products\/testing-python-isbn-9781118901229","provider":"K12savings","version":"1.0","type":"link"}