Skip to content

Instantly share code, notes, and snippets.

@mcdonc
Created August 27, 2015 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcdonc/89bdb5897e04861a0535 to your computer and use it in GitHub Desktop.
Save mcdonc/89bdb5897e04861a0535 to your computer and use it in GitHub Desktop.
cars.com Python Testing Training
-- day 1 --
The Cynical Introduction
All Code Is Terrible
Avoid Shame, Test Everything
Proving It Works Isn't The Goal
But It Makes Me So Slow!?
Don't Be Afraid to Throw It Away
Testing Tenets
Goals
Rules
Guidelines
Conclusion
Types of Tests
Unit
Integration
Functional
Unit Test Jargon
Stub
Fixture
Mock
Phases of Test Execution
Discovery
Running
Reporting
Requirements
Install Python 2.7
Install setuptools
Create a Virtual Environment
The Python ``unittest`` Module (hands-on)
Modes of Discovery
Modes of Running
Interpreting Output
Examples of running a single test (unittest only)
The Typical ``unittest`` Testing Workflow
Starting Out From Nothing
Thereafter
Running A Single Test
Checking In Broken Tests
Running All The Tests Regularly
Interpreting ``unittest`` Testing Output
Antipatterns in Workflow
Not Running Tests
Ignoring Broken Tests
Not Automating Test Execution
Antipatterns When Writing Tests
Bad Fixtures
Bad/Missing Stubs
Bad/Missing Mocks
Misuse of Globals
Making Code Easier to Test
Avoid Global State When Possible
Avoid Designing for Convenience (Don't Give In To ``import`` Fascination)
Composition Usually Beats Inheritance
Avoid Using Others' Code That Breaks These Rules
-- end of day 1 ---
-- day 2 --
Introducing Useful Testing Tools
unittest2
doctest
nose
py.test
tox
mock
sphinx testing integration
selenium
git bisect
Common Test Problems and Their Solutions
SQLAlchemy databases
Mongo databases
Flask globals
Pyramid configuration
-- end of day 2 --
-- day 3 --
Continuous Integration
GitHub
Travis
Jenkins
Workshop (second half of day)
Bring Your Own Code!
-- end of day 3 --
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment