Python Testing with Pytest: Simple, Rapid, Effective, and Scalable
Brian Okken
- 出版商: Pragmatic Bookshelf
- 出版日期: 2017-10-10
- 售價: $1,770
- 貴賓價: 9.5 折 $1,682
- 語言: 英文
- 頁數: 222
- 裝訂: Paperback
- ISBN: 1680502409
- ISBN-13: 9781680502404
-
相關分類:
Python、程式語言、JVM 語言
-
相關翻譯:
pytest 測試實戰 (簡中版)
買這商品的人也買了...
-
$580$458 -
$580$458 -
$1,670$1,587 -
$250BootStrap 開發精解:原理、技術、工具及最佳實踐 (Learning Bootstrap - Modern, Elegant and Responsive Web Design Made Easy)
-
$250鳳凰計畫:一個 IT計畫的傳奇故事 (The Phoenix Project : A Novel about IT, DevOps, and Helping your business win)(沙盤特別版)
-
$680$530 -
$490$417 -
$2,210$2,100 -
$580$458 -
$580$458 -
$250命令行中的數據科學 (Data Science at the Command Line:Facing the Future with Time-Tested Tools)
-
$1,088D3.js 4.x Data Visualization, 3/e (Paperback)
-
$590$460 -
$480$379 -
$580$458 -
$480$379 -
$500$390 -
$450$356 -
$500$390 -
$380$323 -
$301Python機器學習實踐:測試驅動的開發方法
-
$1,782Flask Web Development : Developing Web Applications with Python, 2/e (Paperback)
-
$360$281 -
$960Clean Code in Python: Refactor your legacy codebase (Paperback)
-
$1,715$1,629
相關主題
商品描述
Do less work when testing your Python code, but be just as expressive, just as elegant, and just as readable. The pytest testing framework helps you write tests quickly and keep them readable and maintainable - with no boilerplate code. Using a robust yet simple fixture model, it's just as easy to write small tests with pytest as it is to scale up to complex functional testing for applications, packages, and libraries. This book shows you how.
For Python-based projects, pytest is the undeniable choice to test your code if you're looking for a full-featured, API-independent, flexible, and extensible testing framework. With a full-bodied fixture model that is unmatched in any other tool, the pytest framework gives you powerful features such as assert rewriting and plug-in capability - with no boilerplate code.
With simple step-by-step instructions and sample code, this book gets you up to speed quickly on this easy-to-learn and robust tool. Write short, maintainable tests that elegantly express what you're testing. Add powerful testing features and still speed up test times by distributing tests across multiple processors and running tests in parallel. Use the built-in assert statements to reduce false test failures by separating setup and test failures. Test error conditions and corner cases with expected exception testing, and use one test to run many test cases with parameterized testing. Extend pytest with plugins, connect it to continuous integration systems, and use it in tandem with tox, mock, coverage, unittest, and doctest.
Write simple, maintainable tests that elegantly express what you're testing and why.
What You Need:
The examples in this book are written using Python 3.6 and pytest 3.0. However, pytest 3.0 supports Python 2.6, 2.7, and Python 3.3-3.6.
商品描述(中文翻譯)
測試你的Python程式碼時,可以做更少的工作,但表達力、優雅度和可讀性都不會減少。pytest測試框架可以幫助你快速撰寫測試並保持其可讀性和可維護性,而且不需要冗長的程式碼。使用堅固而簡單的fixture模型,使用pytest撰寫小型測試和複雜功能測試(應用程式、套件和函式庫)同樣容易。本書將向你展示如何使用pytest。
對於基於Python的專案,如果你正在尋找一個功能完整、獨立於API、靈活且可擴展的測試框架,那麼pytest是無可爭議的選擇。pytest擁有無與倫比的fixture模型,提供強大的功能,如斷言重寫和插件能力,而且不需要冗長的程式碼。
本書通過簡單的逐步指示和示例代碼,快速讓你掌握這個易於學習且強大的工具。撰寫簡潔、可維護的測試,優雅地表達你要測試的內容。通過將測試分佈到多個處理器並且並行運行測試,添加強大的測試功能,同時加快測試時間。使用內建的斷言語句,通過分離設置和測試失敗來減少虛假的測試失敗。使用預期的異常測試來測試錯誤條件和邊界情況,並使用一個測試運行多個測試案例。通過插件擴展pytest,將其連接到持續集成系統,並與tox、mock、coverage、unittest和doctest一起使用。
撰寫簡單、可維護的測試,優雅地表達你要測試的內容和原因。
所需工具:
本書中的示例使用Python 3.6和pytest 3.0編寫。然而,pytest 3.0支援Python 2.6、2.7和Python 3.3-3.6。