
۴۴٬۰۰۰تومان
نوع فایل دانلود: EPUB
پس از خرید، یک فایل EPUB دریافت میکنید.
این فایل با Calibre، Apple Books و سایر کتابخوانهای دیجیتال مناسب است.
چارچوب تست pytest کمک میکند تستها را سریع بنویسید و آنها را خوانا و قابل نگهداری نگه دارید — بدون کد تکراری و اضافی. با مدل فیکسچر قوی و در عین حال ساده، نوشتن تستهای کوچک با pytest به همان اندازه آسان است که بالا بردن مقیاس به تستهای کارکردی پیچیده برای برنامهها، بستهها و کتابخانهها. این کتاب نشان میدهد چطور.
هنگام تست کردن کد پایتونتان کمتر کار کنید، اما به همان اندازه بیانگر، زیبا و خوانا باشید. چارچوب تست pytest کمک میکند تستها را سریع بنویسید و آنها را خوانا و قابل نگهداری نگه دارید — بدون کد تکراری و اضافی. با مدل فیکسچر قوی و در عین حال ساده، نوشتن تستهای کوچک با pytest به همان اندازه آسان است که بالا بردن مقیاس به تستهای کارکردی پیچیده برای برنامهها، بستهها و کتابخانهها. این کتاب نشان میدهد چطور.
برای پروژههای مبتنی بر پایتون، اگر بهدنبال یک چارچوب تست کامل، مستقل از API، انعطافپذیر و گسترشپذیر هستید، pytest انتخاب بیرقیب برای تست کدتان است. با مدل فیکسچر پرمحتوایی که در هیچ ابزار دیگری نظیر ندارد، چارچوب pytest امکانات قدرتمندی مثل بازنویسی assert و قابلیت افزونه را در اختیارتان میگذارد — بدون کد تکراری و اضافی. با دستورالعملهای ساده و گامبهگام و کد نمونه، این کتاب سریع شما را با این ابزار آسانیادگیری و قوی آشنا میکند.
تستهای کوتاه و قابل نگهداری بنویسید که بهزیبایی آنچه را تست میکنید بیان کنند. امکانات قدرتمند تست را اضافه کنید و در عین حال با توزیع تستها روی چند پردازنده و اجرای موازی، زمان تست را کم کنید. از دستورات assert داخلی استفاده کنید تا با جدا کردن خطاهای راهاندازی از خطاهای تست، شکستهای کاذب تست را کم کنید. شرایط خطا و موارد مرزی را با تست استثنای مورد انتظار بررسی کنید و با تست پارامتریک، با یک تست چند مورد تست را اجرا کنید. 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 پشتیبانی میکند.
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. 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