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
Python unit test automation practical techniques for Python developers and testers
โ Scribed by Pajankar, Ashwin
- Publisher
- Apress
- Year
- 2017
- Tongue
- English
- Leaves
- 123
- Category
- Library
No coin nor oath required. For personal study only.
โฆ Synopsis
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 Automationwill 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
โฆ Table of Contents
Contents at a Glance......Page 4
Contents......Page 5
About the Author......Page 10
About the Technical Reviewers......Page 11
Acknowledgments......Page 13
Introduction......Page 14
The History of Python......Page 17
Easy to Learn......Page 18
Interpreted......Page 19
Rapid Prototyping......Page 20
The Differences Between Python 2 and Python 3......Page 21
Why Use Python 3......Page 22
Installation on Debian, Ubuntu, and Derivatives......Page 23
Installation on Windows......Page 24
Interactive Mode......Page 27
IDEs for Python......Page 28
IDLE......Page 29
Geany......Page 30
PyCharm......Page 31
Conclusion......Page 33
Test Automation......Page 34
Using Docstrings......Page 35
Example of a Docstring in Python......Page 36
A Brief Introduction to doctest......Page 39
Failing Tests......Page 41
Separate Test File......Page 42
Advantages and Disadvantages of doctest......Page 43
Conclusion......Page 44
Introduction to xUnit......Page 45
Using Unittest......Page 46
Order of Execution of the Test Methods......Page 48
Verbosity Control......Page 49
Multiple Test Classes Within the Same Test File/Module......Page 50
Test Fixtures......Page 51
Running Without unittest.main()......Page 53
Controlling the Granularity of Test Execution......Page 54
Listing All the Command-Line Options and Help......Page 56
Important Command-Line Options......Page 57
Creating a Test Package......Page 60
Placing the Development and Test Code in a Single Directory......Page 62
Placing the Development and Test Code in Separate Directories......Page 63
Test Discovery......Page 67
Coding Conventions for unittest......Page 68
Assertions in unittest......Page 69
Other Useful Methods......Page 70
Failing a Test......Page 71
Exceptions in the Test Case......Page 73
assertRaises()......Page 74
Conclusion......Page 77
Installing nose on Linux OS......Page 78
A Simple nose Test Case......Page 79
Running the Test Module with nosetests......Page 80
Organizing the test code......Page 81
Test Discovery......Page 82
Fixtures for Classes, Modules, and Methods......Page 83
Fixtures for Functions......Page 85
Fixtures for Packages......Page 87
assert_equals()......Page 88
ok_ and eq_......Page 90
The @raises() Decorator......Page 91
The @timed() decorator......Page 92
Creating an XML Report......Page 93
Creating an HTML Report......Page 94
Creating Color Output in the Console......Page 95
Advantages of nose over unittest......Page 96
Using Nose 2......Page 97
Conclusion......Page 98
Introduction to pytest......Page 99
Simple Test......Page 100
Running Tests with the py.test Command......Page 101
Test Class and Test Package in pytest......Page 102
xUnit-Style Fixtures......Page 103
Introduction to pytest Fixtures......Page 105
Scope of pytest Fixtures......Page 108
pytest.raises()......Page 109
Stopping After the First (or N) Failures......Page 110
Conclusion......Page 111
Coding and Filenaming Conventions for Easier Test Discovery......Page 113
Test-Driven Development with pytest......Page 114
Conclusion......Page 120
Index......Page 121
๐ SIMILAR VOLUMES
<div><div><span>Quickly learn how to automate unit testing of Python 3 code with Python 3 automation libraries, such as doctest, unittest, nose, nose2, and pytest.ย </span></div><div><br style="box-sizing: border-box; orphans: 2; widows: 2;"><span>This book explores the important concepts in software
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
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
Quickly learn how to automate unit testing of Python 3 code with Python 3 automation libraries, such as doctest, unittest, nose, nose2, and pytest.<br /><br />This book explores the important concepts in software testing and their implementation in Python 3 and shows you how to automate, organize, a
<p><p>Quickly learn how to automate unit testing of Python 3 code with Python 3 automation libraries, such as doctest, unittest, nose, nose2, and pytest. </p><p>This book explores the important concepts in software testing and their implementation in Python 3 and shows you how to automate, organize,