下载安卓APP箭头
箭头给我发消息

客服QQ:3315713922
读书 > 编程语言 >Python > Python测试驱动开发(影印版)

Python测试驱动开发(影印版)

综合评级:★★★★★

定价:89.00

作者:(美)珀西瓦尔 著

出版社:东南大学出版社

出版日期:2015年9月

页数:463

字数:612000

ISBN:9787564159153

书籍介绍
珀西瓦尔编*的《Python测试驱动开发(影印版)(英文版)》这本实用指南带你从头至尾经历一个真实Web应用开发的全过程,展示了Python测试驱动开发(TDD)的优越性。你将学到如何在应用程序各部分被构建出来之前就编写并运行测试,然后开发* 少量的代码就让这些测试运行通过。结果得到什么?能够运行的简洁代码。

  在书中,你将学到Diango、Selenium、git、 iQuery和Mock的基础知识,另外还有现代Web开发技巧。如果你准备将自己的Python技术提升到下一个层次,这本书清楚地展示了测试驱动开发是如何提倡简单设计并增进信心。

  深入测试驱动开发工作流,包括单元测试/编码周期循环和重构 为类和函数使用单元测试,并为浏览器内的用户交互使用功能测试 学习何时与如何运用mock对象,以及单独和集成测试的优缺点 在开发用服务器上测试以及自动化部署 将测试运用到网站集成的第三方插件上去 使用一个持续集成环境来自动运行测试

相关课程
目录
Preface

Prerequisites and Assumptions

Companion Video

Acknowledgments

Part I. The Basics of TDD and Django

1. Getting Django Set Up Using a Functional Test

Obey the Testing Goat! Do Nothing Until You Have a Test

Getting Django Up and Running

Starting a Git Repository

2. Extending Our Functional Test Using the unittest Module

Using a Functional Test to Scope Out a Minimum Viable app

The Python Standard Library's unittest Module

Implicit waits

Commit

3. Testing a Simple Home Page with Unit Tests

Our First Django App, and Our First Unit Test

Unit Tests, and How They Differ from Functional Tests

Unit Testing in Django

Django's MVC, URLs, and View Functions

At Last! We Actually Write Some Application Code!

urls.py

Unit Testing a View

The Unit-Test/Code Cycle

4. What Are We Doing with All These Tests?

Programming Is like Pulling a Bucket of Water up from a Well

Using Selenium to Test User Interactions

The "Don't Test Constants" Rule, and Templates to the Rescue

Refactoring to Use a Template

On Refactoring

A Little More of Our Front Page

Recap: The TDD Process

S. Saving User Input

Wiring Up Our Form to Send a POST Request

Processing a POST Request on the Server

Passing Python Variables to Be Rendered in the Template

Three Strikes and Refactor

The Django ORM and Our First Model

Our First Database Migration

The Test Gets Surprisingly Far

A New Field Means a New Migration

Saving the POST to the Database

Redirect After a POST

Better Unit Testing Practice: Each Test Should Test One Thing

Rendering Items in the Template

Creating Our Production Database with migrate

6. Getting to the Minimum Viable Site

Ensuring Test Isolation in Functional Tests

Running lust the Unit Tests

Small Design When Necessary

YAGNI!

REST

Implementing the New Design Using TDD

Iterating Towards the New Design

Testing Views, Templates, and URLs Together with the Django Test Client

A New Test Class

A New URL

A New View Function

A Separate Template for Viewing Lists

Another URL and View for Adding List Items

A Test Class for New List Creation

A URL and View for New List Creation

Removing Now-Redundant Code and Tests

Pointing Our Forms at the New URL

Adjusting Our Models

A Foreign Key Relationship

Adjusting the Rest of the World to Our New Models

Each List Should Have Its Own URL

Capturing Parameters from URLs

Adjusting new_list to the New World

One More View to Handle Adding Items to an Existing List

Beware of Greedy Regular Expressions!

The Last New URL

The Last New View

But How to Use That URL in the Form?

A Final Refactor Using URL includes

Part II. web Development Sine Qua Nons

7. Prettification: Layout and Styling, and What to Test About It

8. Testing Deployment Using a Staging Site.

9. Automating Deployment with Fabric

10. Input Validation and Test Organisation

11. A Simple Form

12. More Advanced Forms

13. Dipping Our Toes, Very Tentatively, into javaScript

14. Deploying Our New Code

Part III. More Advanced Topics

15. User Authentication, Integrating Third-Party Plugins, and Mocking with Javascript.

16. Server-Side Authentication and Mocking in Python

17. Test Fixtures, Logging, and Server-Side Debugging

18. Finishing "My Lists": Outside-In TDD

19. Test Isolation, and "Listening to Your Tests".

20. Continuous Inteoration (CI)

21. The Token Social Bit, the Page Pattern, and an Exercise for the Reader

22. Fast Tests, Slow Tests, and Hot Lava..

Obey the Testing Goat!

A. PythonAnywhere

B. Django Class-Based Views

C. Provisioning with Ansible

D. Testing Database Migrations

E. Behaviour-Driven Development (BDD)

F. Cheat Sheet

G. What to Do Next

H. Bibliography

Index

热门图书
推荐新闻
技术文库
论坛推荐