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

Quick links: > What will you learn?> Table of content> Product reviews

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
$16.80
$29.99
RRP $23.99
RRP $29.99
eBook
Print + eBook

Frequently bought together


Test-Driven Development with Django Book Cover
Test-Driven Development with Django
$ 23.99
$ 16.80
Django: Web Development with Python Book Cover
Django: Web Development with Python
$ 67.99
$ 47.60
Buy 2 for $34.30
Save $57.68
Add to Cart

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

Django: Web Development with Python Book Cover
Django: Web Development with Python
$ 67.99
$ 47.60
Mastering Django: Core Book Cover
Mastering Django: Core
$ 39.99
$ 28.00
Building RESTful Python Web Services Book Cover
Building RESTful Python Web Services
$ 39.99
$ 28.00
Web Development with Django Cookbook - Second Edition Book Cover
Web Development with Django Cookbook - Second Edition
$ 39.99
$ 28.00
Python: Master the Art of Design Patterns Book Cover
Python: Master the Art of Design Patterns
$ 67.99
$ 47.60
Large Scale Machine Learning with Python Book Cover
Large Scale Machine Learning with Python
$ 39.99
$ 28.00