Overview of Testing Talks at Pycon

645 views
595 views

Published on

These slides were presented at the April 2012 Django District meetup. More information & be found here: http://bit.ly/JRgpkf.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
645
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
11
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Overview of Testing Talks at Pycon

    1. 1. Testing at PyCon7 hours in 5 minutes Present by @jackiekazil
    2. 2. Repeating themes•Time•Maintainability•Mocking
    3. 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. 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. 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. 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. 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. 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. 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 *

    ×