SlideShare a Scribd company logo
Testing at PyCon
7 hours in 5 minutes




                       Present by @jackiekazil
Repeating themes
•Time

•Maintainability

•Mocking
Time - Taking up sys resources
•Python Profiler only shows CPU Time

•Use Unix time command to look at wall clock time &
 CPU time, then subtract for an idea of I/O time

•lsof - lists open files, pass python id as the process

•Anything stand out? Possibly Django fixtures?

•Watch db logs
Time - Pull out methods
•Pull out methods into free functions

•Factor out the parts that don’t touch the attributes into
 a separate free function

•Watch: Stop Mocking, Start Testing

  •Classes should not be more than 50 lines?
Maintainable Testing
•New code? Design with testing in mind?

•Existing code? Don’t just write tests to write tests when
 you can’t clearly approach the test writing process

•Think about how you can improve your code for testing

•Bad tests costs time

•Use system tests to make up for the lack of tests. :-/
Mocking
•Mimic behavior of real objects in controlled ways, i.e.
 crash test dummy

•Talks to refer to:

  •Fake It Till You Make It

  •Stop Mocking, Start Testing

  •Large Scale Testing
Testing in Django (must watch)
•Don’t write tests that test Django, test your apps

•Django’s test runner thinks tests are in one module

  •Use __init__.py & import all submodules

•Don’t hit the db (Time)

  •Don’t run tests on method that does a self.save()

•Fixtures - just say no; Hard to load & slow
Large Scale Tests
•Interesting note on Fixture bundling...
     TestCase 1: A, B, C
     TestCase 2: A, C, D
     TestCase 3: A, B, C


• Nose can dynamically reorder

     TestCase 1: A, B, C
     TestCase 3: A, B, C
     TestCase 2: A, C, D
Which talks to watch
• Testing in Django *****
• Fake It Til You Make It: Unit Testing Patterns With
  Mocks and Fakes ***
• Speedily Practical Large-Scale Tests ****
• Stop Mocking, Start Testing ***
• Fast Test, Slow Test ***
• Certainty in an Uncertain World: Gaining Confidence
  through Security Testing ***
• pytest - rapid and simple testing with Python **
• Building a Robot that Can Play Angry Birds on a
  Smartphone *

More Related Content

PPTX
Mocking in python
PDF
Is this how you hate unit testing?
PPTX
How to write test in node.js
PDF
Tests immutable when refactoring - SegFault Unconference Cracow 2019
PDF
TDD super mondays-june-2014
PDF
Unit testing (workshop)
PDF
Unit testing
PDF
Ruin your life using robot framework
Mocking in python
Is this how you hate unit testing?
How to write test in node.js
Tests immutable when refactoring - SegFault Unconference Cracow 2019
TDD super mondays-june-2014
Unit testing (workshop)
Unit testing
Ruin your life using robot framework

What's hot (17)

PPT
8 - Javascript unit testing framework
PPTX
Intro to Mocking - DjangoCon 2015
PDF
Test Driven Development in Python
PDF
Fast end-to-end-tests
PPTX
TDD in Go with Ginkgo and Gomega
PDF
Extreme Programming - to the next-level
PPT
Getting Unstuck: Working with Legacy Code and Data
PDF
Instant LAMP Stack with Vagrant and Puppet
ODP
Unit testing-patterns
PPTX
Recap and Feedback from our 1st Code School at Jama Software
PPTX
Working Effectively with Legacy Code
PPTX
Type mock isolator
PDF
Jest: Frontend Testing leicht gemacht @EnterJS2018
PPTX
Working with Legacy Code
PDF
Working With Legacy Code
PPTX
Testing & should i do it
PPTX
An Introduction to unit testing
8 - Javascript unit testing framework
Intro to Mocking - DjangoCon 2015
Test Driven Development in Python
Fast end-to-end-tests
TDD in Go with Ginkgo and Gomega
Extreme Programming - to the next-level
Getting Unstuck: Working with Legacy Code and Data
Instant LAMP Stack with Vagrant and Puppet
Unit testing-patterns
Recap and Feedback from our 1st Code School at Jama Software
Working Effectively with Legacy Code
Type mock isolator
Jest: Frontend Testing leicht gemacht @EnterJS2018
Working with Legacy Code
Working With Legacy Code
Testing & should i do it
An Introduction to unit testing
Ad

Viewers also liked (20)

PDF
The Django Book Chapter 9 - Django Workshop - Taipei.py
PPTX
2016 py con2016_lightingtalk_php to python
PDF
User-centered open source
PPT
Django-Queryset
ODP
Authentication & Authorization in ASPdotNet MVC
PPT
Html5 History-API
PPT
Digesting jQuery
PDF
Django e il Rap Elia Contini
PDF
2007 - 应用系统脆弱性概论
PDF
Vim for Mere Mortals
PDF
Bottle - Python Web Microframework
PDF
The Django Book, Chapter 16: django.contrib
PDF
Django - The Web framework for perfectionists with deadlines
PPT
Load testing
ODP
Rabbitmq & Postgresql
PDF
Django mongodb -djangoday_
PPTX
Super Advanced Python –act1
PDF
Django - The Web framework for perfectionists with deadlines
PDF
2 × 3 = 6
PDF
PythonBrasil[8] closing
The Django Book Chapter 9 - Django Workshop - Taipei.py
2016 py con2016_lightingtalk_php to python
User-centered open source
Django-Queryset
Authentication & Authorization in ASPdotNet MVC
Html5 History-API
Digesting jQuery
Django e il Rap Elia Contini
2007 - 应用系统脆弱性概论
Vim for Mere Mortals
Bottle - Python Web Microframework
The Django Book, Chapter 16: django.contrib
Django - The Web framework for perfectionists with deadlines
Load testing
Rabbitmq & Postgresql
Django mongodb -djangoday_
Super Advanced Python –act1
Django - The Web framework for perfectionists with deadlines
2 × 3 = 6
PythonBrasil[8] closing
Ad

Similar to Overview of Testing Talks at Pycon (20)

ODP
Automated Testing in Django
PDF
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
PPTX
Testing Django APIs
PDF
Token Testing Slides
PPT
Testing In Django
PDF
Write unit test from scratch
PDF
DIY in 5 Minutes: Testing Django App with Pytest
PPTX
A Beginer's Guide to testing in Django
PPTX
Django strategy-test
PDF
Testdriven Development With Python 1st Edition Harry J W Percival
PDF
10 ways to shoot yourself in the foot with tests - Shai Geva, PyCon IL, 2024
PDF
Testing Django Applications
PDF
TDD in Python With Pytest
PDF
The Future is Now: Writing Automated Tests To Grow Your Code
PDF
Factories, mocks and spies: a tester's little helpers
PDF
Two Scope of Django 1.6 Chapter 20 and 21
PDF
Software Testing
PPTX
Unit testing and mocking in Python - PyCon 2018 - Kenya
PDF
Python Testing 101 with Selenium
PDF
A minimal Django testing styleguide
Automated Testing in Django
DjangoCon 2013 - How to Write Fast and Efficient Unit Tests in Django
Testing Django APIs
Token Testing Slides
Testing In Django
Write unit test from scratch
DIY in 5 Minutes: Testing Django App with Pytest
A Beginer's Guide to testing in Django
Django strategy-test
Testdriven Development With Python 1st Edition Harry J W Percival
10 ways to shoot yourself in the foot with tests - Shai Geva, PyCon IL, 2024
Testing Django Applications
TDD in Python With Pytest
The Future is Now: Writing Automated Tests To Grow Your Code
Factories, mocks and spies: a tester's little helpers
Two Scope of Django 1.6 Chapter 20 and 21
Software Testing
Unit testing and mocking in Python - PyCon 2018 - Kenya
Python Testing 101 with Selenium
A minimal Django testing styleguide

Recently uploaded (20)

PDF
Empathic Computing: Creating Shared Understanding
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Electronic commerce courselecture one. Pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
Big Data Technologies - Introduction.pptx
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
sap open course for s4hana steps from ECC to s4
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
cuic standard and advanced reporting.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
Empathic Computing: Creating Shared Understanding
Mobile App Security Testing_ A Comprehensive Guide.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Electronic commerce courselecture one. Pdf
Programs and apps: productivity, graphics, security and other tools
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Big Data Technologies - Introduction.pptx
Spectral efficient network and resource selection model in 5G networks
sap open course for s4hana steps from ECC to s4
The AUB Centre for AI in Media Proposal.docx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Machine learning based COVID-19 study performance prediction
Network Security Unit 5.pdf for BCA BBA.
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
cuic standard and advanced reporting.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
MIND Revenue Release Quarter 2 2025 Press Release
Reach Out and Touch Someone: Haptics and Empathic Computing
Digital-Transformation-Roadmap-for-Companies.pptx

Overview of Testing Talks at Pycon

  • 1. Testing at PyCon 7 hours in 5 minutes Present by @jackiekazil
  • 3. Time - Taking up sys resources •Python Profiler only shows CPU Time •Use Unix time command to look at wall clock time & CPU time, then subtract for an idea of I/O time •lsof - lists open files, pass python id as the process •Anything stand out? Possibly Django fixtures? •Watch db logs
  • 4. Time - Pull out methods •Pull out methods into free functions •Factor out the parts that don’t touch the attributes into a separate free function •Watch: Stop Mocking, Start Testing •Classes should not be more than 50 lines?
  • 5. Maintainable Testing •New code? Design with testing in mind? •Existing code? Don’t just write tests to write tests when you can’t clearly approach the test writing process •Think about how you can improve your code for testing •Bad tests costs time •Use system tests to make up for the lack of tests. :-/
  • 6. Mocking •Mimic behavior of real objects in controlled ways, i.e. crash test dummy •Talks to refer to: •Fake It Till You Make It •Stop Mocking, Start Testing •Large Scale Testing
  • 7. Testing in Django (must watch) •Don’t write tests that test Django, test your apps •Django’s test runner thinks tests are in one module •Use __init__.py & import all submodules •Don’t hit the db (Time) •Don’t run tests on method that does a self.save() •Fixtures - just say no; Hard to load & slow
  • 8. Large Scale Tests •Interesting note on Fixture bundling... TestCase 1: A, B, C TestCase 2: A, C, D TestCase 3: A, B, C • Nose can dynamically reorder TestCase 1: A, B, C TestCase 3: A, B, C TestCase 2: A, C, D
  • 9. Which talks to watch • Testing in Django ***** • Fake It Til You Make It: Unit Testing Patterns With Mocks and Fakes *** • Speedily Practical Large-Scale Tests **** • Stop Mocking, Start Testing *** • Fast Test, Slow Test *** • Certainty in an Uncertain World: Gaining Confidence through Security Testing *** • pytest - rapid and simple testing with Python ** • Building a Robot that Can Play Angry Birds on a Smartphone *

Editor's Notes