Test-Driven Development with Django

Develop powerful, fully-featured Django applications by writing tests first
Preview in Mapt

Test-Driven Development with Django

Kevin Harvey

1 customer reviews
Develop powerful, fully-featured Django applications by writing tests first
Mapt Subscription
FREE
$29.99/m after trial
eBook
$16.80
RRP $23.99
Save 29%
Print + eBook
$29.99
RRP $29.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packtโ€™s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$16.80
$29.99
$29.99p/m after trial
RRP $23.99
RRP $29.99
Subscription
eBook
Print + eBook
Start 30 Day Trial

Frequently bought together


Test-Driven Development with Django Book Cover
Test-Driven Development with Django
$ 23.99
$ 16.80
Test-Driven iOS Development with Swift 3 Book Cover
Test-Driven iOS Development with Swift 3
$ 31.99
$ 22.40
Buy 2 for $34.30
Save $21.68
Add to Cart
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 

Book Details

ISBN 139781785281167
Paperback186 pages

Book Description

Test-Driven Development (TDD) simplifies the trickiest of software tasks with its unique ability to peel back problems into layers. The testing tools available in Python and Django make test writing a joy, and the full coverage test suite that results from TDD is a boon to any project.

This guide to developing with Django takes a test-first approach: write a test, then write enough production code to get it to pass. You'll quickly get hands-on experience, writing tests for a database-driven application with the TDD methodology. Use this book to build the skills and habits that make testing a regular part of your workflow.

Table of Contents

Chapter 1: Keeping Your Promises
What is Test-Driven Development?
How does TDD help in building better software?
Doesn't it take longer?
Can't I just write the tests later?
Summary
Chapter 2: Your First Test-Driven Application
Where do we begin?
Functional versus unit tests
The project โ€“ jmad.us
Setting up your environment
Starting the project
Setting up a Django app for unit tests
Finally writing application code
Summary
Chapter 3: Ironclad Code
Using the Python Debugger in tests
Using RequestFactory
Managing test data
Refactoring
DRY testing
RequestFactory versus TestClient
Summary
Chapter 4: Building Out and Refactoring
Improving the application
A new view
Pretty URLs
Back into the TDD cycle
Skipping ahead a bit
Starting a new app
Much ado about migrations
Updating the functional test
Refactoring the index view
Summary
Chapter 5: User Stories As Code
A second user story
Adding content via the Django admin
Finishing up
Summary
Chapter 6: No App Is an Island
What is a mock?
MusicBrainz
Using the API in our application
Mocking โ€“ when and why
Summary
Chapter 7: Share and Share Alike
It's an API world, we're just coding in it
Introducing Django REST framework
Adding data via the API
Summary
Chapter 8: Promises Kept
How far we've come
To tend or not to tend?
Fight through the gotchas
Thanks!

What You Will Learn

  • Codify user stories as browser-based tests to ensure their completion
  • Write isolated unit tests that not only confirm your application, but also explain it
  • Use the red-green-refactor TDD cycle to create and refine your code by changing tests first
  • Test integrations with external APIs by testing their documentation
  • Mock out calls to external services and internal functions
  • Explore the basics of documentation-driven API design
  • Other testing tools available in popular Python packages such as Django REST framework and VCR.py

Authors

Table of Contents

Chapter 1: Keeping Your Promises
What is Test-Driven Development?
How does TDD help in building better software?
Doesn't it take longer?
Can't I just write the tests later?
Summary
Chapter 2: Your First Test-Driven Application
Where do we begin?
Functional versus unit tests
The project โ€“ jmad.us
Setting up your environment
Starting the project
Setting up a Django app for unit tests
Finally writing application code
Summary
Chapter 3: Ironclad Code
Using the Python Debugger in tests
Using RequestFactory
Managing test data
Refactoring
DRY testing
RequestFactory versus TestClient
Summary
Chapter 4: Building Out and Refactoring
Improving the application
A new view
Pretty URLs
Back into the TDD cycle
Skipping ahead a bit
Starting a new app
Much ado about migrations
Updating the functional test
Refactoring the index view
Summary
Chapter 5: User Stories As Code
A second user story
Adding content via the Django admin
Finishing up
Summary
Chapter 6: No App Is an Island
What is a mock?
MusicBrainz
Using the API in our application
Mocking โ€“ when and why
Summary
Chapter 7: Share and Share Alike
It's an API world, we're just coding in it
Introducing Django REST framework
Adding data via the API
Summary
Chapter 8: Promises Kept
How far we've come
To tend or not to tend?
Fight through the gotchas
Thanks!

Book Details

ISBN 139781785281167
Paperback186 pages
Read More
From 1 reviews

Read More Reviews

Recommended for You

Web Development with Django Cookbook Book Cover
Web Development with Django Cookbook
$ 29.99
$ 6.00
Python Machine Learning Book Cover
Python Machine Learning
$ 35.99
$ 25.20
Mastering Object-oriented Python Book Cover
Mastering Object-oriented Python
$ 26.99
$ 18.90
Django By Example Book Cover
Django By Example
$ 35.99
$ 25.20
Functional Python Programming Book Cover
Functional Python Programming
$ 29.99
$ 21.00
3D Game Development with Unity 5.x [Video] Book Cover
3D Game Development with Unity 5.x [Video]
$ 124.99
$ 106.25