Python Testing with Pytest: Simple, Rapid, Effective, and Scalable (Paperback)
Okken, Brian
- 出版商: Pragmatic Bookshelf
- 出版日期: 2022-03-29
- 定價: $1,800
- 售價: 9.5 折 $1,710
- 語言: 英文
- 頁數: 274
- 裝訂: Quality Paper - also called trade paper
- ISBN: 1680508601
- ISBN-13: 9781680508604
-
相關分類:
Python、程式語言、JVM 語言
立即出貨 (庫存=1)
買這商品的人也買了...
-
$580$458 -
$780$616 -
$390$371 -
$780$616 -
$1,000$790 -
$454軟件自動化測試實戰解析:基於Python3編程語言
-
$2,475Software Architecture: The Hard Parts: Modern Trade-Off Analyses for Distributed Architectures (Paperback)
-
$720$562 -
$600$570 -
$594$564 -
$2,682Fluent Python: Clear, Concise, and Effective Programming, 2/e (Paperback)
-
$780$616 -
$1,599$1,439 -
$720$562 -
$690$538 -
$560跟老韓學 Linux 自動化運維 (基礎篇)
-
$299$284 -
$414$393 -
$2,150$2,043 -
$820$640 -
$860$671 -
$620$484 -
$1,280$1,011 -
$880$695 -
$980$774
相關主題
商品描述
Test applications, packages, and libraries large and small with pytest, Python's most powerful testing framework. pytest helps you write tests quickly and keep them readable and maintainable. In this fully revised edition, explore pytest's superpowers - simple asserts, fixtures, parametrization, markers, and plugins - while creating simple tests and test suites against a small database application. 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. This book shows you how.
pytest is undeniably the best choice for testing Python projects. It's a full-featured, flexible, and extensible testing framework. pytest's fixture model allows you to share test data and setup procedures across multiple layers of tests. The pytest framework gives you powerful features such as assert rewriting, parametrization, markers, plugins, parallel test execution, and clear test failure reporting - 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 yet powerful tool. Write short, maintainable tests that elegantly express what you're testing. Speed up test times by distributing tests across multiple processors and running tests in parallel. Use Python's builtin assert statements instead of awkward assert helper functions to make your tests more readable. Move setup code out of tests and into fixtures to separate setup failures from 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, and even existing unittest tests.
Write simple, maintainable tests quickly with pytest.
What You Need:
The examples in this book were written using Python 3.9 and pytest 6. pytest 6 supports Python 3.5 and above.
商品描述(中文翻譯)
使用 pytest,Python 最強大的測試框架,來測試各種大小的應用程式、套件和函式庫。pytest 幫助您快速撰寫測試並保持其可讀性和可維護性。在這本完全修訂的新版中,您將探索 pytest 的超能力 - 簡單的斷言、固定裝置、參數化、標記和插件 - 同時對一個小型資料庫應用程式進行簡單的測試和測試套件。使用堅固而簡單的固定裝置模型,使用 pytest 撰寫小型測試和擴展到複雜的功能測試同樣容易。本書將向您展示如何做到這一點。
pytest 無疑是測試 Python 專案的最佳選擇。它是一個功能完整、靈活且可擴展的測試框架。pytest 的固定裝置模型允許您在多個測試層之間共享測試數據和設置程序。pytest 框架提供了強大的功能,如斷言重寫、參數化、標記、插件、並行測試執行和清晰的測試失敗報告 - 而無需冗長的程式碼。
本書通過簡單的逐步指示和示例程式碼,快速讓您掌握這個易於學習但功能強大的工具。撰寫簡短、易於維護的測試,優雅地表達您正在測試的內容。通過將測試分佈到多個處理器並且並行運行測試,加快測試時間。使用 Python 內建的斷言語句,而不是笨拙的斷言輔助函式,使您的測試更易讀。將設置程式碼從測試中分離出來,放入固定裝置中,以將設置失敗與測試失敗區分開來。使用預期的例外測試來測試錯誤條件和邊界情況,並使用一個測試運行多個測試案例的參數化測試。通過插件擴展 pytest,將其連接到持續整合系統,並與 tox、mock、coverage 甚至現有的 unittest 測試一起使用。
使用 pytest 快速撰寫簡單且易於維護的測試。
您需要什麼:
本書中的示例是使用 Python 3.9 和 pytest 6 撰寫的。pytest 6 支援 Python 3.5 及以上版本。
作者簡介
Brian Okken is the host of the Test & Code podcast, and co-host of the Python Bytes podcast. He's also a lead software engineer.
作者簡介(中文翻譯)
Brian Okken是Test & Code podcast的主持人,也是Python Bytes podcast的共同主持人。他還是一位首席軟體工程師。