By taking you through the development of a real web application from beginning to end, the second edition of this hands-on guide demonstrates the practical advantages of test-driven development (TDD) with Python. You’ll learn how to write and run tests before building each part of your app, and then develop the minimum amount of code required to pass those tests. The result? Clean code that works. In the process, you’ll learn the basics of Django, Selenium, Git, jQuery, and Mock, along with current web development techniques. If you’re ready to take your Python skills to the next level, this book—updated for Python 3.6—clearly demonstrates how TDD encourages simple designs and inspires confidence. Dive into the TDD workflow, including the unit test/code cycle and refactoring Use unit tests for classes and functions, and functional tests for user interactions within the browser Learn when and how to use mock objects, and the pros and cons of isolated vs. integrated tests Test and automate your deployments with a staging server Apply tests to the third-party plugins you integrate into your site Run tests automatically by using a Continuous Integration environment Use TDD to build a REST API with a front-end Ajax interface
Test-Driven Development (TDD) simplifies the trickiest of software tasks with its unique ability to peel back problems into layers. The testing tools available in Python and Django make test writing a joy, and the full coverage test suite that results from TDD is a boon to any project. This guide to developing with Django takes a test-first approach: write a test, then write enough production code to get it to pass. You'll quickly get hands-on experience, writing tests for a database-driven application with the TDD methodology. Use this book to build the skills and habits that make testing a regular part of your workflow.
Author: Kent Beck
Publisher: Addison-Wesley Professional
Release Date: 2003
Write clean code that works with the help of this groundbreaking software method. Example-driven teaching is the basis of Beck's step-by-step instruction that will have readers using TDD to further their projects.
This book is intended for Python developers who want to use the principles of test-driven development (TDD) to create efficient and robust applications. In order to get the best out of this book, you should have development experience with Python.
Author: David Sale
Publisher: John Wiley & Sons
Release Date: 2014-07-03
Fundamental testing methodologies applied to the popular Python language 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.
Fix everyday testing problems in Python with the help of this solution-based guide Key Features Use powerful tools such as doctest and unittest to make testing convenient Apply automation testing to an existing legacy system that isn't test oriented A practical guide to ease testing in Python using real-world examples Book Description Automated testing is the best way to increase efficiency while reducing the defects of software testing. It helps find bugs in code easily and at an early stage so that they can be tackled efficiently. This book delves into essential testing concepts used in Python to help you build robust and maintainable code. Python Testing Cookbook begins with a brief introduction to Python's unit testing framework to help you write automated test cases. You will learn how to write suitable test sets for your software and run automated test suites with Nose. You will then work with the unittest.mock library, which allows you to replace the parts of your system that are being tested with mock objects and make assertions about how they have been used. You will also see how to apply Test-driven Development (TDD) and Behavior-driven Development (BDD) and how to eliminate issues caused by TDD. The book explains how to integrate automated tests using Continuous Integration and perform smoke/load testing. It also covers best practices and will help you solve persistent testing issues in Python. The book concludes by helping you understand how doctest works and how Selenium can be used to test code efficiently. What you will learn Run test cases from the command line with increased verbosity Write a Nose extension to pick tests based on regular expressions Create testable documentation using doctest Use Selenium to test the Web User Interface Write a testable story with Voidspace Mock and Nose Configure TeamCity to run Python tests on commit Update project-level scripts to provide coverage reports Who this book is for If you’re a Python developer who wants to take testing to the next level and would like to expand your testing skills, this book is for you. It is assumed that you have some Python programming knowledge.
Learn the basics of test driven development (TDD) using Ruby. You will carry out problem domain analysis, solution domain analysis, designing test cases, and writing tests first. These fundamental concepts will give you a solid TDD foundation to build upon. Test Driven Development in Ruby is written by a developer for developers. The concepts are first explained, then a coding demo illustrates how to apply the theory in practice. At the end of each chapter an exercise is given to reinforce the material. Complete with working files and code samples, you'll be able to work alongside the author, a trainer, by following the material in this book. What You Will Learn Carry out problem domain analysis, solution domain analysis, designing test cases, and writing tests first Use assertions Discover the structure of a test and the TDD cycle Gain an understanding of minimal implementation, starter test, story test, and next test Handle refactoring using Ruby Hide implementation details Test precisely and concretely Make your code robust Who This Book Is For Experienced Ruby programmers or web developers with some prior experience with Ruby.
Author: Graham Lee
Release Date: 2012-04-12
As iOS apps become increasingly complex and business-critical, iOS developers must ensure consistently superior code quality. This means adopting best practices for creating and testing iOS apps. Test-Driven Development (TDD) is one of the most powerful of these best practices. Test-Driven iOS Development is the first book 100% focused on helping you successfully implement TDD and unit testing in an iOS environment. Long-time iOS/Mac developer Graham Lee helps you rapidly integrate TDD into your existing processes using Apple’s Xcode 4 and the OCUnit unit testing framework. He guides you through constructing an entire Objective-C iOS app in a test-driven manner, from initial specification to functional product. Lee also introduces powerful patterns for applying TDD in iOS development, and previews powerful automated testing capabilities that will soon arrive on the iOS platform. Coverage includes Understanding the purpose, benefits, and costs of unit testing in iOS environments Mastering the principles of TDD, and applying them in areas from app design to refactoring Writing usable, readable, and repeatable iOS unit tests Using OCUnit to set up your Xcode project for TDD Using domain analysis to identify the classes and interactions your app needs, and designing it accordingly Considering third-party tools for iOS unit testing Building networking code in a test-driven manner Automating testing of view controller code that interacts with users Designing to interfaces, not implementations Testing concurrent code that typically runs in the background Applying TDD to existing apps Preparing for Behavior Driven Development (BDD) The only iOS-specific guide to TDD and unit testing, Test-Driven iOS Development covers both essential concepts and practical implementation.
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 expected nor do you need to have any knowledge of the libraries discussed in the book.
The agile development movement represents the latest advances in tools and techniques intended to boost developer productivity. This is the first book to apply these sought after principles to Python developers, introducing both the tools and techniques built and supported by the Python community. Authored by Jeff Younker, who is perhaps best known for his creation of a popular Python testing framework, this book is sure to be a hit among readers who may have reached their limits of knowledge regarding the Python language, yet are seeking to improve their understanding of how sound processes can boost productivity to unparalleled heights.
Author: Jeff Forcier
Publisher: Addison-Wesley Professional
Release Date: 2008-10-24
Using the simple, robust, Python-based Django framework, you can build powerful Web solutions with remarkably few lines of code. In Python Web Development with Django®, three experienced Django and Python developers cover all the techniques, tools, and concepts you need to make the most of Django 1.0, including all the major features of the new release. The authors teach Django through in-depth explanations, plus provide extensive sample code supported with images and line-by-line explanations. You’ll discover how Django leverages Python’s development speed and flexibility to help you solve a wide spectrum of Web development problems and learn Django best practices covered nowhere else. You’ll build your first Django application in just minutes and deepen your real-world skills through start-to-finish application projects including Simple Web log (blog) Online photo gallery Simple content management system Ajax-powered live blogger Online source code sharing/syntax highlighting tool How to run your Django applications on the Google App Engine This complete guide starts by introducing Python, Django, and Web development concepts, then dives into the Django framework, providing a deep understanding of its major components (models, views, templates), and how they come together to form complete Web applications. After a discussion of four independent working Django applications, coverage turns to advanced topics, such as caching, extending the template system, syndication, admin customization, and testing. Valuable reference appendices cover using the command-line, installing and configuring Django, development tools, exploring existing Django applications, the Google App Engine, and how to get more involved with the Django community. Introduction 1 Part I: Getting Started Chapter 1: Practical Python for Django 7 Chapter 2: Django for the Impatient: Building a Blog 57 Chapter 3: Starting Out 77 Part II: Django in Depth Chapter 4: Defining and Using Models 89 Chapter 5: URLs, HTTP Mechanisms, and Views 117 Chapter 6: Templates and Form Processing 135 Part III: Django Applications by Example Chapter 7: Photo Gallery 159 Chapter 8: Content Management System 181 Chapter 9: Liveblog 205 Chapter 10: Pastebin 221 Part IV: Advanced Django Techniques and Features Chapter 11: Advanced Django Programming 235 Chapter 12: Advanced Django Deployment 261 Part V: Appendices Appendix A: Command Line Basics 285 Appendix B: Installing and Running Django 295 Appendix C: Tools for Practical Django Development 313 Appendix D: Finding, Evaluating, and Using Django Applications 321 Appendix E: Django on the Google App Engine 325 Appendix F: Getting Involved in the Django Project 337 Index 339 Colophon 375
Quickly learn how to automate unit testing of Python 3 code with Python 3 automation libraries, such as doctest, unittest, nose, nose2, and pytest. This book explores the important concepts in software testing and their implementation in Python 3 and shows you how to automate, organize, and execute unit tests for this language. This knowledge is often acquired by reading source code, manuals, and posting questions on community forums, which tends to be a slow and painful process. Python Unit Test Automation will allow you to quickly ramp up your understanding of unit test libraries for Python 3 through the practical use of code examples and exercises. All of which makes this book a great resource for software developers and testers who want to get started with unit test automation in Python 3 and compare the differences with Python 2. This short work is your must-have quick start guide to mastering the essential concepts of software testing in Python. What You'll Learn: Essential concepts in software testing Various test automation libraries for Python, such as doctest, unittest, nose, nose2, and pytest Test-driven development and best practices for test automation in Python Code examples and exercises Who This Book Is For: Python developers, software testers, open source enthusiasts, and contributors to the Python community
Author: Michel Anders
Publisher: Packt Publishing Ltd
Release Date: 2011-05-12
Part of Packt's Beginner's Guide Series, this book follows a sample application, with lots of screenshots, to help you get to grips with the techniques as quickly as possible. Moderately experienced Python programmers who want to learn how to create fairly complex, database-driven, cross browser compatible web apps that are maintainable and look good will find this book of most use. All key technologies except for Python 3 are explained in detail.