Python Unit Test Automation: Automate, Organize, and Execute Unit Tests in Python (Paperback)
暫譯: Python 單元測試自動化:在 Python 中自動化、組織和執行單元測試 (平裝本)

Pajankar, Ashwin

買這商品的人也買了...

商品描述

Learn how to automate unit tests of Python 3 with automation libraries, such as doctest, unittest, nose, nose2, pytest, and selenium. This book explores important concepts in software test automation and demonstrates how to automate, organize, and execute unit tests with Python. It also introduces readers to the concepts of web browser automation and logging.

This new edition starts with an introduction to Python 3. Next, it covers doctest and pydoc. This is followed by a discussion on unittest, a framework that comes packaged with Python 3 itself. There is a dedicated section on creating test suites, followed by an explanation of how nose2 provides automatic test module discovery. Moving forward, you will learn about pytest, the most popular third-party library and testrunner for Python. You will see how to write and execute tests with pytest. You’ll also learn to discover tests automatically with pytest.

This edition features two brand new chapters, the first of which focuses on the basics of web browser automation with Selenium. You’ll learn how to use Selenium with unittest to write test cases for browser automation and use the Selenium IDE with web browsers such as Chrome and Firefox. You’ll then explore logging frameworks such as Python’s built-in logger and the third-party framework loguru.

The book concludes with an exploration of test-driven development with pytest, during which you will execute a small project using TDD methodology.

What You Will Learn

• Start testing with doctest and unittest
• Understand the idea of unit testing
• Get started with nose 2 and pytest
• Learn how to use logger and loguru
• Work with Selenium and test driven development

Who This Book Is ForPython developers, software testers, open source enthusiasts, and contributors to the Python community.

商品描述(中文翻譯)

學習如何使用自動化庫(如 doctest、unittest、nose、nose2、pytest 和 selenium)自動化 Python 3 的單元測試。本書探討了軟體測試自動化中的重要概念,並演示如何使用 Python 自動化、組織和執行單元測試。它還向讀者介紹了網頁瀏覽器自動化和日誌記錄的概念。

本新版本首先介紹 Python 3。接下來,涵蓋了 doctest 和 pydoc。然後討論 unittest,這是一個隨 Python 3 自帶的框架。專門有一個部分介紹如何創建測試套件,接著解釋 nose2 如何提供自動測試模組發現。接下來,您將學習 pytest,這是最受歡迎的第三方庫和 Python 的測試執行器。您將看到如何使用 pytest 編寫和執行測試。您還將學習如何使用 pytest 自動發現測試。

本版本包含兩個全新的章節,第一個章節專注於使用 Selenium 進行網頁瀏覽器自動化的基本知識。您將學習如何將 Selenium 與 unittest 結合使用,為瀏覽器自動化編寫測試案例,並使用 Selenium IDE 與 Chrome 和 Firefox 等網頁瀏覽器。然後,您將探索日誌記錄框架,例如 Python 的內建日誌記錄器和第三方框架 loguru。

本書最後探討了使用 pytest 的測試驅動開發(TDD),在此過程中,您將使用 TDD 方法執行一個小項目。

您將學到的內容

• 開始使用 doctest 和 unittest 測試
• 理解單元測試的概念
• 開始使用 nose2 和 pytest
• 學習如何使用 logger 和 loguru
• 使用 Selenium 和測試驅動開發

本書適合對象:Python 開發者、軟體測試人員、開源愛好者以及 Python 社群的貢獻者。

作者簡介

Ashwin Pajankar holds a Master of Technology from IIIT Hyderabad, and has over 25 years of programming experience. He started his journey in programming and electronics with BASIC programming language and is now proficient in Assembly programming, C, C++, Java, Shell Scripting, and Python. Other technical experience includes single board computers such as Raspberry Pi and Banana Pro, and Arduino. He is currently a freelance online instructor teaching programming bootcamps to more than 60,000 students from tech companies and colleges. His Youtube channel has an audience of 10000 subscribers and he has published more than 15 books on programming and electronics with many international publications.

作者簡介(中文翻譯)

Ashwin Pajankar 擁有印度海德拉巴國際資訊科技學院 (IIIT Hyderabad) 的科技碩士學位,並擁有超過 25 年的程式設計經驗。他的程式設計和電子學之旅始於 BASIC 程式語言,現在精通組合語言 (Assembly)、C、C++、Java、Shell 腳本和 Python。其他技術經驗包括單板電腦,如 Raspberry Pi 和 Banana Pro,以及 Arduino。他目前是一名自由職業的線上講師,教授程式設計訓練營,學生來自超過 60,000 名科技公司和大學。他的 YouTube 頻道擁有 10,000 名訂閱者,並已出版超過 15 本有關程式設計和電子學的書籍,並有許多國際出版物。