Overview of Testing Talks at Pycon

  • 409 views
Uploaded on

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

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

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
409
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
10
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n

Transcript

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