失效链接处理 |
Python_Testing_Cookbook PDF 下载
本站整理下载:
提取码:5zvc
相关截图:
主要内容:
Preface
Testing has always been a part of software development. For decades, comprehensive testing
was defined by complex manual test procedures backed by big budgets; but something
revolutionary happened in 1998. In his Guide to Better Smalltalk, Smalltalk guru Kent Beck
introduced an automated test framework called SUnit. This triggered an avalanche of test
frameworks including JUnit, PyUnit, and many others for different languages and various
platforms, dubbed the xUnit movement. Automated testing was made a cornerstone
of the agile movement when 17 top software experts signed the Agile Manifesto in 2001.
Testing includes many different styles including unit testing, integration testing, acceptance
testing, smoke testing, load testing, and countless others. This book digs in and explores
testing at all the important levels while using the nimble power of Python. It also shows many
tools.
This book is meant to expand your knowledge of testing from something you either heard
about or have practiced a little into something you can apply at any level to meet your needs
in improving software quality. I hope to give you the tools to reap huge rewards in better
software development and customer satisfaction.
What this book covers
Chapter 1, Using Unittest to Develop Basic Tests, gives you a quick introduction to the most
commonly used test framework in the Python community.
Chapter 2, Running Automated Tests with Nose, introduces the most ubiquitous Python test
tool and gets busy by showing how to write specialized plugins.
Chapter 3, Creating Testable Documentation with doctest, shows many different ways to use
Python's docstrings to build runnable doctests as well as writing custom test runners.
Chapter 4, Testing Customer Stories with Behavior Driven Development, dives into writing
easy-to-read testable customer stories using doctest, mocking, and Lettuce/Should DSL.
Preface
Chapter 5, High Level Customer Scenarios with Acceptance Testing, helps you get into the
mindset of the customer and write tests from their perspective using Pyccuracy and the
Robot Framework.
Chapter 6, Integrating Automated Tests with Continuous Integration, shows how to add
continuous integration to your development process with Jenkins and TeamCity.
Chapter 7, Measuring your Success with Test Coverage, explores how to create coverage
reports and interpret them correctly. It also digs in to see how to tie them in with your
continuous integration system.
Chapter 8, Smoke/Load Testing—Testing Major Parts, shows how to create smoke test suites
to get a pulse from the system. It also shows how to put the system under load to make sure
it can handle the current load as well as finding the next breaking point for future loads.
Chapter 9, Good Test Habits for New and Legacy Systems, shows many different lessons
learned from the author about what works when it comes to software testing.
What you need for this book
You will need Python 2.6 or above. The recipes in this book have NOT been tested against
Python 3+. This book uses many other Python test tools, but includes detailed steps to show
how to install and use them.
Who this book is for
This book is for Python developers who want to take testing to the next level. It covers different
styles of testing, giving any developer an expanded set of testing skills to help write better
systems. It also captures lessons learned from the author, explaining not only how to write
better tests but why.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of
information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text are shown as follows: "Create a new file called recipe1.py to store all of
this recipe's code."
A block of code is set as follows:
def test_parsing_millenia(self):
value = RomanNumeralConverter("M")
self.assertEquals(1000, value.convert_to_decimal())
2
Preface
When we wish to draw your attention to a particular part of a code block, the relevant lines or
items are set in bold:
if __name__ == "__main__":
unittest.main()
New terms and important words are shown in bold. Words that you see on the screen, in
menus or dialog boxes for example, appear in the text like this: "The unittest module provides
a convenient way to find all the test methods in a TestClass".
|