文件名称:Python Testing - Beginner's Guide (2010).pdf
文件大小:4.55MB
文件格式:PDF
更新时间:2022-09-07 16:52:35
Python Testing Beginner's Guide
Preface Like any programmer, you need to be able to produce reliable code that conforms to a specification, which means that you need to test your code. In this book, you'll learn how to use techniques and Python tools that reduce the effort involved in testing, and at the same time make it more useful—and even fun. You'll learn about several of Python's automated testing tools, and you'll learn about the philosophies and methodologies that they were designed to support, like unit testing and test-driven development. When you're done, you'll be able to produce thoroughly tested code faster and more easily than ever before, and you'll be able to do it in a way that doesn't distract you from your "real" programming. What this book covers Chapter 1: Testing for Fun and Profit introduces Python test-driven development and various testing methods. Chapter 2: Doctest: The Easiest Testing Tool covers the doctest tool and teaches you how to use it. Chapter 3: Unit Testing with Doctest introduces the ideas of unit testing and test-driven development, and applies doctest to create unit tests. Chapter 4: Breaking Tight Coupling by using Mock Objects covers mock objects and the Python Mocker tool. Chapter 5: When Doctest isn't Enough: Unittest to the Rescue introduces the unittest framework and discusses when it is preferred over doctest. Chapter 6: Running Your Tests: Follow Your Nose introduces the Nose test runner, and discusses project organization. This material is copyright and is licensed for the sole use by Betty Vaughan-Pope on 1st February 2010 2601 S Broadway St, Unit 29, La Porte, , 77571 Preface [ ] Chapter 7: Developing a Test-Driven Project walks through a complete test-driven development process. Chapter 8: Testing Web Application Frontends using Twill applies the knowledge gained from previous chapters to web applications, and introduces the Twill tool. Chapter 9: Integration Testing and System Testing teaches how to build from unit tests to tests of a complete software system. Chapter 10: Other Testing Tools and Techniques introduces code coverage and continuous integration, and teaches how to tie automated testing into version control systems. Appendix: Answers to Pop Quizes contains the answers to all pop quizes, chapter-wise. What you need for this book To use this book, you will need a working Python interpreter, preferably one of the 2.6 version series. You'll also need a source code editor, and occasional access to the internet. You will need to be comfortable enough using your operating system's textual interface—your DOS prompt or command shell—to do basic directory management and to run programs. Who this book is for 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.