Python Unit Test Automation: Automate, Organize, and Execute Unit Tests in Python (Paperback)

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,這是最受歡迎的第三方庫和測試運行器。您將看到如何使用pytest編寫和執行測試。您還將學習如何使用pytest自動發現測試。

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

本書以使用pytest進行測試驅動開發作為結尾,您將使用TDD方法執行一個小型項目。

您將學到什麼:

- 開始使用doctest和unittest進行測試
- 理解單元測試的概念
- 開始使用nose2和pytest
- 學習如何使用日誌記錄器和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擁有印度國際資訊科技學院海得拉巴分校的碩士學位,並擁有超過25年的程式設計經驗。他從BASIC程式語言開始他的程式設計和電子學之旅,現在精通組合語言程式設計、C、C++、Java、Shell腳本和Python。他還具有使用Raspberry Pi、Banana Pro和Arduino等單板電腦的技術經驗。他目前是一位自由職業的線上講師,為來自科技公司和大學的超過60,000名學生教授程式設計訓練營。他的YouTube頻道有10,000名訂閱者,並且已經出版了15本以上的程式設計和電子學書籍,其中包括許多國際出版物。