Index
A
- A-Records, Configuring Domains for Staging and Live
- acceptance tests, Using a Functional Test to Scope Out a Minimum
Viable App
- (see also functional tests)
- aesthetics, testing, What to Functionally Test About Layout and Style
- (see also design and layout testing)
- agile movement, Not Big Design Up Front
- ALLOWED_HOSTS, Using Environment Variables to Adjust Settings for Production
- angular.js, A Few Things That Didn’t Make It
- Ansible, Automating Provisioning with Ansible, Provisioning with Ansible-Use Vagrant to Spin Up a Local VM
- architectural solutions, Architectural Solutions
- assertContains method, Taking a First, Self-Contained Step: One New URL
- assertRegex, Ensuring We Have a Regression Test
- authentication, User Authentication, Spiking, and
De-Spiking-A Token Model to Link Emails with a Unique ID
- avoiding secrets in source code, Another Secret, Another Environment Variable
- cookies and, Skipping the Login Process by Pre-creating a Session
- custom authentication models, Custom Authentication Models
- custom Django authentication, Finishing the Custom Django Auth-Finishing the Custom Django Auth
- frontend log in UI, Frontend Log in UI
- minimal custom user model, A Minimal Custom User Model-Tests as Documentation
- passwordless, Passwordless Auth
- sending emails from Django, Sending Emails from Django-Sending Emails from Django
- skipping in FTs, Test Fixtures and a Decorator for
Explicit Waits
- storing tokens in databases, Storing Tokens in the Database
- token model to link emails, A Token Model to Link Emails with a Unique ID-A Token Model to Link Emails with a Unique ID
- automated deployment (see also Fabric)
B
- Behave, What Is BDD?
- behavior-driven development (BDD), What Is BDD?-Some Tentative Conclusions
- benefits and drawbacks of, Will Nonprogrammers Write Tests?
- capturing parameters in steps, Capturing Parameters in Steps
- comparing inline-style FT, Comparing the Inline-Style FT
- defined, What Is BDD?
- directory creation, Basic Housekeeping
- functional test using Gherkin syntax, Writing an FT as a “Feature” Using Gherkin Syntax
- vs. inline comments, BDD Might Be Less Expressive than Inline Comments
- page pattern, The Page Pattern as an Alternative
- step functions, Coding the Step Functions
- structured test code encouraged by, BDD Encourages Structured Test Code
- tools for, What Is BDD?
- Big Design Up Front, Not Big Design Up Front
- black box tests (see functional tests)
- blank items, preventing, Start on a Validation FT: Preventing Blank Items-Running a Single Test File
- Bootstrap
C
- call_args property, An Alternative Reason to Use Mocks: Reducing Duplication
- cheat sheet
- class-based generic views (CBGVs)
- code examples, obtaining and using, Using Code Examples, Recap: The TDD Process, What Is BDD?, Source Code Examples
- code smell, Three Strikes and Refactor
- collectstatic command, What We Glossed Over: collectstatic and Other Static Directories-What We Glossed Over: collectstatic and Other Static Directories
- combinatorial explosion, An Alternative Reason to Use Mocks: Reducing Duplication
- comments and questions, Preface
- companion video, Companion Video
- complex views vs. thin views, Using the Form’s Own Save Method
- configuration management tools, Automating Provisioning with Ansible
- console.log, console.log for Debug Printing
- contact information, Preface
- continuous deployment tools, Provisioning with Ansible
- Continuous Integration (CI), Continuous Integration (CI)-More Things to Do with a CI Server
- additional uses for, More Things to Do with a CI Server
- benefits of, Continuous Integration (CI)
- first build, First Build!
- Jenkins configuration, Configuring Jenkins
- Jenkins installation, Installing Jenkins
- project setup, Setting Up Our Project
- QUnit JavaScript tests, Running Our QUnit JavaScript Tests in Jenkins with PhantomJS-Adding the Build Steps to Jenkins
- screenshots, Taking Screenshots-If in Doubt, Try Bumping the Timeout!
- server of choice, Continuous Integration (CI)
- staging and, More Things to Do with a CI Server
- timeout bumping, If in Doubt, Try Bumping the Timeout!
- tips, More Things to Do with a CI Server, Keep Your CI Builds Green
- virtual display setup, Setting Up a Virtual Display So the FTs Can Run Headless-Setting Up a Virtual Display So the FTs Can Run Headless
- cookies, Skipping the Login Process by Pre-creating a Session
- Cross-Site Request Forgery (CSRF), Wiring Up Our Form to Send a POST Request
- CSS (Cascading Style Sheets)
- Cucumber, What Is BDD?
D
- data integrity errors, A Django Quirk: Model Save Doesn’t Run Validation, Using get_absolute_url for Redirects, Some Integrity Errors Do Show Up on Save
- database migrations, Our First Database Migration, Creating Our Production Database with migrate, Creating the Database with migrate, Testing Database Migrations-Conclusions
- database testing
- database-layer validation, Validation at the Database Layer-Using get_absolute_url for Redirects
- HTML POST requests
- invalid input, Checking That Invalid Input Isn’t Saved to the Database
- managing test databases, Managing the Test Database on Staging-Against staging:
- migrations, Testing Database Migrations-Conclusions
- Object-Relational Mapper (ORM), The Django ORM and Our First Model-A New Field Means a New Migration
- production database creation, Creating Our Production Database with migrate-Creating Our Production Database with migrate
- rendering items in the template, Rendering Items in the Template-Rendering Items in the Template
- safeguarding production databases, Against staging:, Wrap-Up
- template syntax, Passing Python Variables to Be Rendered in the Template-An Unexpected Failure
- three strikes and refactor rule, Three Strikes and Refactor-Three Strikes and Refactor, Enforcing Model Validation in view_list
- DEBUG settings, What We Need to Do, Using Environment Variables to Adjust Settings for Production
- debugging
- Django DEBUG page, Wiring Up Our Form to Send a POST Request
- improving error messages, An Unexpected Failure
- manual visits, Rendering Items in the Template
- of functional tests, Wiring Up Our Form to Send a POST Request, A New View Function
- screenshots for, Taking Screenshots-If in Doubt, Try Bumping the Timeout!, More Things to Do with a CI Server
- server provisioning, Simple Nginx Configuration
- server-side
- Systemd, Using Systemd to Make Sure Gunicorn Starts on Boot
- decorators
- deployment
- design and layout testing
- Django framework
- class-based generic views, Wrapping Up: What We’ve Learned About Testing Django, Django Class-Based Views-Take-Home: Having Multiple, Isolated View Tests with Single Assertions Helps
- code structure in, Our First Django App, and Our First Unit Test
- commands and concepts
- documentation, Using Our Auth Backend in the Login View
- installation, Installing Django and Selenium
- messages framework, Testing the Django Messages Framework
- Object-Relational Mapper (ORM), The Django ORM and Our First Model-A New Field Means a New Migration
- and PythonAnywhere, Setting Up Django as a PythonAnywhere Web App
- running functional and/or unit tests, Running Just the Unit Tests
- sending emails, Sending Emails from Django-Sending Emails from Django, Using Mocks to Test External Dependencies or Reduce Duplication, Adapting Our FT to Be Able to Test Real Emails via POP3-Adapting Our FT to Be Able to Test Real Emails via POP3
- set up, Obey the Testing Goat! Do Nothing Until You Have a Test-Starting a Git Repository
- static files in, Static Files in Django-Switching to StaticLiveServerTestCase
- template inheritance, Django Template Inheritance
- Test Client, The Django Test Client-The Django Test Client
- tutorials, Django, The Django ORM and Our First Model
- unit testing in, Our First Django App, and Our First Unit Test-The Unit-Test/Code Cycle
- django-allauth, Exploratory Coding, aka “Spiking”
- django-crispy-forms, Exploring the Forms API with a Unit Test
- django-floppyforms, Exploring the Forms API with a Unit Test
- Django-Rest-Framework (DRF), Django-Rest-Framework-Free Functionality
- benefits of, What Django-Rest-Framework Gives You
- client-side adaptations, Adapting the Client Side
- installation, Installation
- ModelSerializers, Serializers (Well, ModelSerializers, Really)
- ModelViewsets, Viewsets (Well, ModelViewsets, Really) and Routers
- POST requests, A Different URL for POST Item
- tips for, Free Functionality
- tutorials, Serializers (Well, ModelSerializers, Really)
- documentation, Tests as Documentation
- domain names, Getting a Domain Name
- Don’t Repeat Yourself (DRY), Three Strikes and Refactor, An Exercise for the Reader
- “Don’t Test Constants” rule, The “Don’t Test Constants” Rule, and Templates to the Rescue
- double-hashes (##), Ensuring We Have a Regression Test
- duck typing, Final Step: Feeding Through the .name API from the Template
- dumpdata command, Our Final Explicit Wait Helper: A Wait Decorator
- duplicate items testing
- duplication, eliminating, An Unexpected Failure, An Alternative Reason to Use Mocks: Reducing Duplication-Patching at the Class Level, Finishing Off Our FT, Testing Logout, Our Final Explicit Wait Helper: A Wait Decorator, The Page Pattern-The Page Pattern
E
- emails, sending from Django, Sending Emails from Django-Sending Emails from Django, Using Mocks to Test External Dependencies or Reduce Duplication, Adapting Our FT to Be Able to Test Real Emails via POP3-Adapting Our FT to Be Able to Test Real Emails via POP3
- end-to-end tests (see functional tests)
- environment variables, As Always, Start with a Test, Another Secret, Another Environment Variable, Another Environment Variable
- errata, Submitting Errata
- error messages, Wiring Up Our Form to Send a POST Request
- (see also troubleshooting)
- expected failures, Using a Functional Test to Scope Out a Minimum
Viable App, Commit
- explicit and implicit waits, On Implicit and Explicit Waits, and Voodoo time.sleeps-On Implicit and Explicit Waits, and Voodoo time.sleeps, A New Functional Test Tool: A Generic Explicit Wait Helper, Our Final Explicit Wait Helper: A Wait Decorator-Our Final Explicit Wait Helper: A Wait Decorator
- exploratory coding, Exploring the Forms API with a Unit Test (see also spiking and de-spiking)
- external dependencies, Using Mocks to Test External Dependencies or Reduce Duplication, Finishing Off Our FT, Testing Logout
F
- f-string syntax, An Unexpected Failure
- Fabric
- factory_boy, Our Final Explicit Wait Helper: A Wait Decorator
- feedback, Preface
- find and replace function, A Big Find and Replace
- Firefox
- fixtures
- fixtures div, Using jQuery and the Fixtures Div-Using jQuery and the Fixtures Div, Fixtures, Execution Order, and Global State: Key Challenges of JS Testing
- form control classes (Bootstrap), Large Inputs, Surfacing Model Validation Errors in the View
- form data validation
- benefits of, Moving Validation Logic into a Form, But Have We Wasted a Lot of Time?
- best practices, Using the Form’s Own Save Method
- for duplicate items, Another FT for Duplicate Items-Wrapping Up: What We’ve Learned About Testing Django
- moving validation logic to forms, Moving Validation Logic into a Form-Testing and Customising Form Validation
- preventing blank items, Start on a Validation FT: Preventing Blank Items-Running a Single Test File
- processing POST and GET requests, Using the Form in the Other View-An Unexpected Benefit: Free Client-Side Validation from HTML5
- processing POST requests, Using the Form in a View That Takes POST Requests-Using the Form to Display Errors in the Template
- using forms in views, Using the Form in Our Views-A Big Find and Replace
- using form’s own save method, Using the Form’s Own Save Method-Using the Form’s Own Save Method
- Forms API, Exploring the Forms API with a Unit Test
- (see also form data validation)
- form_valid, Using form_valid to Customise a CreateView
- full_clean method, A Django Quirk: Model Save Doesn’t Run Validation
- functional programming, A New Functional Test Tool: A Generic Explicit Wait Helper
- functional tests (FTs)
- vs. acceptance and system tests, Fast Tests, Slow Tests, and Hot Lava
- benefits and drawbacks of, Onwards!
- creating, Obey the Testing Goat! Do Nothing Until You Have a Test
- debugging techniques, Wiring Up Our Form to Send a POST Request, A New View Function
- for duplicate items, Another FT for Duplicate Items-Some Integrity Errors Do Show Up on Save
- ensuring isolation, Ensuring Test Isolation in Functional Tests-Running Just the Unit Tests, Test Isolation, and “Listening to Your Tests”-Onwards!
- using Gherkin syntax, Writing an FT as a “Feature” Using Gherkin Syntax
- helper methods in, Finishing Off the FT
- implicit/explicit waits and time.sleeps, On Implicit and Explicit Waits, and Voodoo time.sleeps-On Implicit and Explicit Waits, and Voodoo time.sleeps, A New Functional Test Tool: A Generic Explicit Wait Helper
- JavaScript, Starting with an FT-A Few Things That Didn’t Make It
- for mocks, The Moment of Truth: Will the FT Pass?
- with multiple users, The Token Social Bit, the Page Pattern, and an Exercise for the Reader-An Exercise for the Reader
- outside-in technique, The FT for “My Lists”
- running single test files, Running a Single Test File
- spiked code and, A Token Model to Link Emails with a Unique ID
- splitting into many files, Splitting Functional Tests Out into Many Files-Splitting Functional Tests Out into Many Files
- structuring test code, The Token Social Bit, the Page Pattern, and an Exercise for the Reader-An Exercise for the Reader, BDD Encourages Structured Test Code
- troubleshooting hung tests, Aside: Upgrading Selenium and Geckodriver
- vs. unit tests, Unit Tests, and How They Differ from Functional Tests
- using unittest module, Extending Our Functional Test Using
the unittest Module-Commit
- for validation, Start on a Validation FT: Preventing Blank Items-Running a Single Test File
G
- Geckodriver
- generator expressions, Using Selenium to Test User Interactions
- generic explicit wait helper, A New Functional Test Tool: A Generic Explicit Wait Helper-A New Functional Test Tool: A Generic Explicit Wait Helper, Refactoring Unit Tests into Several Files
- GET requests, Using the Form in a View with a GET Request
- getting help, Testing a Simple Home Page with
Unit Tests, Spinning Up a Server, The Deployment Chapter, What to Do Next
- get_absolute_url, Using get_absolute_url for Redirects
- get_user method, The get_user Method
- Gherkin, What Is BDD?-Not Always a Perfect Fit!
- Git
- commits, Starting a Git Repository, Commit
- configuring, Git’s Default Editor, and Other Basic Git Config
- creating branches, Starting a Branch for the Spike
- detecting moved files, Ensuring Test Isolation in Functional Tests
- diff -b, Django Template Inheritance
- downloading, Required Software Installations
- local variables, Deploying Our Code Manually
- moving files, Ensuring Test Isolation in Functional Tests
- reset --hard, What to Functionally Test About Layout and Style
- starting repositories, Starting a Git Repository
- tagging releases, Git Tag the Release
- global state, Fixtures, Execution Order, and Global State: Key Challenges of JS Testing, A Few Things That Didn’t Make It
- Gmail, Sending Emails from Django
- greedy regular expressions, Beware of Greedy Regular Expressions!
- Green, Setting Up a Basic JavaScript Test Runner
- grep command, A Big Find and Replace
- Gunicorn
I
- idempotency, Automating Provisioning with Ansible
- implicit and explicit waits, On Implicit and Explicit Waits, and Voodoo time.sleeps-On Implicit and Explicit Waits, and Voodoo time.sleeps, A New Functional Test Tool: A Generic Explicit Wait Helper, Our Final Explicit Wait Helper: A Wait Decorator-Our Final Explicit Wait Helper: A Wait Decorator
- infrastructure as code, Automating Deployment with Fabric
- inline comments, BDD Might Be Less Expressive than Inline Comments
- inside-out TDD, Why Prefer “Outside-In”?
- integrated development environments (IDEs), JavaScript
- integrated tests
- invalid input, Checking That Invalid Input Isn’t Saved to the Database
- (see also model-layer validation)
- isolation, ensuring
- benefits and drawbacks of, Test Isolation, and “Listening to Your Tests”, Onwards!
- failed test example, Revisiting Our Decision Point: The Views Layer Depends on Unwritten Models Code
- forms layer, Moving Down to the Forms Layer-Keep Listening to Your Tests: Removing ORM Code from Our Application
- in functional tests, Ensuring Test Isolation in Functional Tests-Running Just the Unit Tests
- vs. integrated tests, Conclusions: When to Write Isolated Versus Integrated Tests-Should You Do Both?
- layer interactions as contracts, Thinking of Interactions Between Layers as “Contracts”-Fixing the Oversight
- using mocks for, A First Attempt at Using Mocks for Isolation-Using Mock side_effects to Check the Sequence of Events
- models layer, Finally, Moving Down to the Models Layer-Back to Views
- refactoring ugly tests, Listen to Your Tests: Ugly Tests Signal a Need to Refactor
- removing redundant code, Tidy Up: What to Keep from Our Integrated Test Suite-Removing Redundant Code at the Forms Layer
- risks of mocking, The Moment of Truth (and the Risks of Mocking)
- view layer, Rewriting Our Tests for the View to Be Fully Isolated-Thinking in Terms of Collaborators
- iterative development style, Saving User Input: Testing the Database, Iterating Towards the New Design
J
- Jasmine, A Few Things That Didn’t Make It
- JavaScript testing
- additional considerations for, A Few Things That Didn’t Make It
- additional resources, Dipping Our Toes, Very Tentatively,
into JavaScript
- boilerplate and namespacing, Columbo Says: Onload Boilerplate and Namespacing
- functional test, Starting with an FT
- in Jenkins with PhantomJS, Running Our QUnit JavaScript Tests in Jenkins with PhantomJS-Adding the Build Steps to Jenkins
- jQuery and fixtures div, Using jQuery and the Fixtures Div-Using jQuery and the Fixtures Div
- key challenges of, Fixtures, Execution Order, and Global State: Key Challenges of JS Testing-Using an Initialize Function for More Control Over Execution Time
- managing global state, Fixtures, Execution Order, and Global State: Key Challenges of JS Testing, A Few Things That Didn’t Make It
- syntax errors, A Few Things That Didn’t Make It
- in the TDD cycle, JavaScript Testing in the TDD Cycle
- test running libraries, Setting Up a Basic JavaScript Test Runner-Setting Up a Basic JavaScript Test Runner, A Few Things That Didn’t Make It
- unit test, Building a JavaScript Unit Test for Our Desired Functionality
- Jenkins
- jQuery, Using jQuery and the Fixtures Div-Using jQuery and the Fixtures Div
- JSON fixtures, Checking That It Works, Our Final Explicit Wait Helper: A Wait Decorator
- jumbotron class (Bootstrap), Jumbotron!
L
- lambda functions, A New Functional Test Tool: A Generic Explicit Wait Helper
- layout (see CSS; design and layout testing)
- Lettuce, What Is BDD?
- Linux servers, Spinning Up a Server
- list comprehensions, Using Selenium to Test User Interactions
- list items, An Unexpected Failure, Rendering Items in the Template, A Third Small Step: A URL for Adding List Items-A Regression! Pointing Our Forms at the New URL, Start on a Validation FT: Preventing Blank Items-Running a Single Test File
- LiveServerTestCase class, Ensuring Test Isolation in Functional Tests
- loaddata command, Our Final Explicit Wait Helper: A Wait Decorator
- logging, Finishing the Custom Django Auth, Inspecting Logs on the Server, Wrap-Up
- login process, skipping, Skipping the Login Process by Pre-creating a Session
- (see also authentication)
M
- MacOS, Required Software Installations
- mail.out box attribute, Using Mocks to Test External Dependencies or Reduce Duplication
- Meta attributes, Preventing Duplicates at the Model Layer
- meta-comments, Ensuring We Have a Regression Test
- minimum viable applications, Not Big Design Up Front
- mocks
- benefits and drawbacks of, Using Mocks to Test External Dependencies or Reduce Duplication, The Moment of Truth (and the Risks of Mocking), Onwards!
- de-spiking custom authentication, De-spiking Our Custom Authentication Backend-Using Our Auth Backend in the Login View
- functional test for, The Moment of Truth: Will the FT Pass?
- isolating tests using, A Decision Point: Whether to Proceed to the Next Layer with a Failing Test, A First Attempt at Using Mocks for Isolation-Using Mock side_effects to Check the Sequence of Events
- logout link, Finishing Off Our FT, Testing Logout
- manual, Mocking Manually, aka Monkeypatching-Mocking Manually, aka Monkeypatching
- mock.return_value, Using mock.return_value
- mock_auth variable, Patching at the Class Level
- practical application of, It Works in Theory! Does It Work in Practice?
- preparing for, Before We Start: Getting the Basic Plumbing In
- Python Mock library, The Python Mock Library-Checking That We Send the User a Link with a Token, Finishing Off Our FT, Testing Logout
- reducing duplication with, An Alternative Reason to Use Mocks: Reducing Duplication-Patching at the Class Level, Finishing Off Our FT, Testing Logout
- model-layer validation
- Model-View-Controller (MVC) pattern, Django’s MVC, URLs, and View Functions, REST (ish)
- ModelForm class, Switching to a Django ModelForm
- monkeypatching, Mocking Manually, aka Monkeypatching-Mocking Manually, aka Monkeypatching, Finishing Off Our FT, Testing Logout
- multiple lists testing
- adding items to existing lists, Each List Should Have Its Own URL-Adjusting new_list to the New World
- incremental design implementation, Implementing the New Design Incrementally Using TDD
- iterative development style, Iterating Towards the New Design
- list item URLs, A Third Small Step: A URL for Adding List Items-A Regression! Pointing Our Forms at the New URL
- model adjustments, Biting the Bullet: Adjusting Our Models-Adjusting the Rest of the World to Our New Models
- refactoring, Green? Refactor
- refactoring using URL includes, A Final Refactor Using URL includes-A Final Refactor Using URL includes
- regression test, Ensuring We Have a Regression Test-Ensuring We Have a Regression Test
- separate list viewing templates, Another Small Step: A Separate Template for Viewing Lists-Another Small Step: A Separate Template for Viewing Lists
- small vs. big design, Small Design When Necessary-REST (ish)
- URL mappings, Taking a First, Self-Contained Step: One New URL-A New View Function
- MVC frameworks, A Few Things That Didn’t Make It
P
- Page pattern
- page pattern, The Page Pattern as an Alternative
- passwords, User Authentication, Spiking, and
De-Spiking
- patch decorator, Patching at the Class Level, Finishing Off Our FT, Testing Logout
- permanent redirect (301), Beware of Greedy Regular Expressions!
- PhantomJS, Running Our QUnit JavaScript Tests in Jenkins with PhantomJS-Adding the Build Steps to Jenkins
- Platform-As-A-Service (PaaS), Choosing Where to Host Our Site, Saving Our Progress
- POST requests
- prerequisite knowledge, Prerequisites and Assumptions-Some Error Messages You’re Likely to See When You Inevitably Fail to Activate Your Virtualenv
- print statements, Wiring Up Our Form to Send a POST Request
- production databases, Against staging:, Wrap-Up
- production-ready deployment
- programming by wishful thinking, Final Step: Feeding Through the .name API from the Template
- prototyping (see spiking and de-spiking)
- pytest, Setting Up a Basic JavaScript Test Runner
- Python 3
- python-social-auth, Exploratory Coding, aka “Spiking”
- PythonAnywhere, Python 3 and Programming, Choosing Where to Host Our Site, PythonAnywhere-The Deployment Chapter
R
- React, A Few Things That Didn’t Make It
- Red/Green/Refactor, An Unexpected Failure, Recap, Green? Refactor, Skipping a Test, Refactoring Unit Tests into Several Files
- refactoring, Refactoring to Use a Template-Refactoring to Use a Template, On Refactoring, Three Strikes and Refactor-Three Strikes and Refactor, Green? Refactor, Skipping a Test, Refactoring Unit Tests into Several Files, Refactoring Unit Tests into Several Files, Listen to Your Tests: Ugly Tests Signal a Need to Refactor
- regression, Recap, Ensuring We Have a Regression Test-Ensuring We Have a Regression Test
- regular expressions, Beware of Greedy Regular Expressions!
- Representational State Transfer (REST)
- requirements.txt, Creating a Virtualenv on the Server Using requirements.txt, Saving Our Changes: Adding Gunicorn to Our requirements.txt
- response.context, Testing the Response Context Objects Directly
- reverse lookups, Testing the Response Context Objects Directly
S
- scratchpad to-do list, Recap
- screenshots, Taking Screenshots-If in Doubt, Try Bumping the Timeout!, More Things to Do with a CI Server
- scripts, building standalone, A Django Management Command to Create Sessions
- secret values, Another Environment Variable
- security issues and settings
- sed (stream editor), Provisioning: Nginx and Gunicorn Config Using sed
- Selenium
- self.assertRaises context manager, The self.assertRaises Context Manager
- self.browser.refresh(), Switching to StaticLiveServerTestCase
- self.wait_for helper method, Finishing Off the FT, Refactoring Unit Tests into Several Files, Our Final Explicit Wait Helper: A Wait Decorator
- send_mail function, Sending Emails from Django-Sending Emails from Django
- server provisioning, Manually Provisioning a Server to Host Our Site, Simple Nginx Configuration
- sessions, pre-creating, Skipping the Login Process by Pre-creating a Session-Checking That It Works, Managing the Test Database on Staging
- single-assertion unit tests, Take-Home: Having Multiple, Isolated View Tests with Single Assertions Helps
- small vs. big design, Small Design When Necessary-REST (ish), A Final Refactor Using URL includes
- socket.error: [WinError 10054], Switching to StaticLiveServerTestCase
- software requirements, Required Software Installations-Setting Up Your Virtualenv
- spiking and de-spiking
- staging sites
- adapting functional tests for, As Always, Start with a Test-As Always, Start with a Test
- benefits of, TDD and the Danger Areas of Deployment, Success! Our Hack Deployment Works
- catching final bugs with, The Proof Is in the Pudding: Using Staging to Catch Final Bugs-Inspecting Logs on the Server
- continuous integrations and, More Things to Do with a CI Server
- domain names, Getting a Domain Name
- fixtures and, Wrap-Up
- local vs. staged sessions, Recap: Creating Sessions Locally Versus Staging
- managing test databases, Managing the Test Database on Staging-Against staging:
- manual code deployment, Deploying Our Code Manually
- manual server provisioning, Manually Provisioning a Server to Host Our Site
- StaleElementException, On Implicit and Explicit Waits, and Voodoo time.sleeps
- static files
- StaticLiveServerTestCase, Switching to StaticLiveServerTestCase
- stderr, Finishing the Custom Django Auth
- string representations, A Little Digression on Queryset Ordering and String Representations-A Little Digression on Queryset Ordering and String Representations
- style (see CSS; design and layout testing)
- superlists, Getting Django Up and Running
- system tests, Fast Tests, Slow Tests, and Hot Lava
- Systemd, Using Systemd to Make Sure Gunicorn Starts on Boot
T
- table styling (Bootstrap), Table Styling
- templates
- Test Client (Django), The Django Test Client-The Django Test Client
- test files
- test fixtures, Checking That It Works, Our Final Explicit Wait Helper: A Wait Decorator
- test running libraries, Setting Up a Basic JavaScript Test Runner
- Test-Driven Development (TDD)
- adapting existing code incrementally, Working Incrementally-A Final Refactor Using URL includes
- additional resources, Testing a Simple Home Page with
Unit Tests, Conclusion
- concepts
- expected failures, Commit
- Red/Green/Refactor, An Unexpected Failure, Recap, Skipping a Test, Refactoring Unit Tests into Several Files
- regression, Recap
- scratchpad to-do list, Recap
- three strikes and refactor, Recap, Enforcing Model Validation in view_list
- triangulation, An Unexpected Failure, Recap
- unexpected failures, An Unexpected Failure, Recap
- unit-test/code cycle, The Unit-Test/Code Cycle
- user stories, Commit
- future investigations, What to Do Next-Your Suggestion Here
- JavaScipt testing in, JavaScript Testing in the TDD Cycle
- need for, Why I Wrote a Book About Test-Driven Development-Why I Wrote a Book About Test-Driven Development, What Are We Doing with All These Tests? (And, Refactoring)-Programming Is Like Pulling a Bucket of Water Up
from a Well
- outside-in technique, Finishing “My Lists”: Outside-In TDD-Final Step: Feeding Through the .name API from the Template
- overall process of, Recap: The TDD Process-Recap: The TDD Process, Implementing the New Design Incrementally Using TDD, The Basic TDD Workflow
- philosophy of
- prerequisite knowledge assumed, Prerequisites and Assumptions-Some Error Messages You’re Likely to See When You Inevitably Fail to Activate Your Virtualenv
- test goals, Synthesis: What Do We Want from Our Tests, Anyway?
- video-based instruction, Companion Video
- testing best practices, Better Unit Testing Practice: Each Test Should Test One Thing, On Implicit and Explicit Waits, and Voodoo time.sleeps, Using the Form’s Own Save Method, Synthesis: What Do We Want from Our Tests, Anyway?, Take-Home: Having Multiple, Isolated View Tests with Single Assertions Helps, General Testing Best Practices
- Testing Goat
- tests as documentation, Tests as Documentation
- thin views vs. complex views, Using the Form’s Own Save Method
- three strikes and refactor rule, Three Strikes and Refactor-Three Strikes and Refactor, Recap, Enforcing Model Validation in view_list
- time.sleeps, Wiring Up Our Form to Send a POST Request, On Implicit and Explicit Waits, and Voodoo time.sleeps-On Implicit and Explicit Waits, and Voodoo time.sleeps
- tokens, Storing Tokens in the Database
- tracebacks, At Last! We Actually Write Some Application Code!, Using Environment Variables to Adjust Settings for Production
- triangulation, An Unexpected Failure, Recap
- troubleshooting
- typographical conventions, Conventions Used in This Book
U
- unexpected failures, An Unexpected Failure, Recap
- uniqueness validation, A More Complex Form to Handle Uniqueness Validation
- (see also duplicate items testing)
- unit tests
- benefits of “pure”, Thesis: Unit Tests Are Superfast and Good Besides That-And Unit Tests Drive Good Design
- in Django
- “Don’t Test Constants” rule, The “Don’t Test Constants” Rule, and Templates to the Rescue
- drawbacks of “pure”, The Problems with “Pure” Unit Tests
- Forms API, Exploring the Forms API with a Unit Test
- vs. functional tests, Unit Tests, and How They Differ from Functional Tests
- vs. integrated tests, The Django ORM and Our First Model, Fast Tests, Slow Tests, and Hot Lava
- JavaScript, Building a JavaScript Unit Test for Our Desired Functionality
- length of, Saving the POST to the Database
- refactoring in, Refactoring to Use a Template-Refactoring to Use a Template, On Refactoring
- refactoring into several files, Refactoring Unit Tests into Several Files
- testing only one thing, Better Unit Testing Practice: Each Test Should Test One Thing, Using the Form’s Own Save Method, Take-Home: Having Multiple, Isolated View Tests with Single Assertions Helps
- using for exploratory coding, Exploring the Forms API with a Unit Test
- unit-test/code cycle, The Unit-Test/Code Cycle, The Unit-Test/Code Cycle, An Unexpected Failure
- unittest module
- Unix domain sockets, Switching to Using Unix Sockets
- URL mappings, urls.py, Taking a First, Self-Contained Step: One New URL-A New View Function, A Third Small Step: A URL for Adding List Items-A Regression! Pointing Our Forms at the New URL, Refactor: Removing Hardcoded URLs-Using get_absolute_url for Redirects
- user interactions
- user stories, Using a Functional Test to Scope Out a Minimum
Viable App, Commit