Testing Python: Applying Unit Testing, TDD, BDD and Acceptance Testing 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.
Unit 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.
Learn Unit Testing and TDD--important development methodologies that lie at the heart of Agile development Enhance your ability to work with Python to develop powerful, flexible applications with clean code Draw on the expertise of author David Sale, a leading UK developer and tech commentator Get ahead of the crowd by mastering the underappreciated world of Python testing Knowledge of software testing in Python could set you apart from Python developers using outmoded methodologies. Python is a natural fit for TDD and Testing Python is a must-read text for anyone who wants to develop expertise in Python programming.
Table of contents
Introduction
- CHAPTER 1 : A History of Testing
You Do Test, Don’t You?
Fundamentals and Best Practices
Summary
- CHAPTER 2 : Writing Unit Tests
What Is Unit Testing?
What Should You Test?
Writing Your First Unit Test
Following the PEP-8 Standard
Unit Test Structure
Additional Unit Test Examples
Useful Methods in Unit Testing
Summary
- CHAPTER 3 : Utilizing Unit Test Tools
Using Python’s Nose
PyTest: An Alternative Test Runner
Mock and Patch Tricky Situations
Summary
- CHAPTER 4 : Writing Testable Documentation
Writing Your First Doctest
Improving Doctests with Nose Integration
Summary
Resources
- CHAPTER 5 : Driving Your Development with Tests
Agile Development
Ethos of Test Driven Development
Advantages of Test Driven Development
Ping-Pong Programming
Test Driving Your Problem
Summary
Resources
- CHAPTER 6 : Writing Acceptance Tests
What Is Acceptance Testing?
Letting Behavior Drive Your Problem
Advanced Acceptance Test Techniques
Summary
Resources
- CHAPTER 7 : Utilizing Acceptance Test Tools
Cucumber: The Acceptance Test Standard
Lettuce in Detail
Robot: An Alternative Test Framework
Summary
Resources
- CHAPTER 8 : Maximizing Your Code’s Performance
Understanding the Importance of Performance Testing
JMeter and Python
Code Profiling with cProfile
Summary
Resources
- CHAPTER 9 : Looking After Your Lint
Coming to Grips with Pylint
Covering All Your Code with Unit Tests
Summary
Resources
- CHAPTER 10 : Automating Your Processes
Build Paver Tasks
Setting Up Automated Builds [with Jenkins]
Summary
Resources
- CHAPTER 11 : Deploying Your Application
Deploying Your Application to Production [on the Cloud with Heroku]
Smoke Testing a Deployed Application
Summary
Resources
- CHAPTER 12 : The Future of Testing Python
Stub the Solution
Making Deployment Natural
Automating (Nearly) Everything
Working in Public
Collaborating on Step Definitions
Final Thoughts
Resources
Index