0
Testing for people
who hate writing tests
Tips and tricks for organizing and
writing simple tests with pytest.
Writing tests is painful
●
●
●
●

what to test
how to do it
takes time
QQ...
Case study
User facing
● Mobile API (Bono)
● Livelovely.com (Spot)
● Pro.livelovely.com (Pearl)
● Messaging API (Ditto)
● ...
Organizing
● mimic application structure
○ easy to remember
○ helps scope tests
○ easy test hooks

● pytest discovery
○ ht...
Theres a fixture for that...
● test fixture is a fixed state of the software
under test used as a baseline for running
tes...
Request fixture
User fixture
Test using fixture
Interaction Fixture
Test using fixture
@linuxlewis -- @lovely http://livelovely.com
sam@livelovely.com
http://github.com/linuxlewis
https://github.com/linuxlewis...
Testing for people who hate testing
Upcoming SlideShare
Loading in...5
×

Testing for people who hate testing

221

Published on

SF Python Meetup lightning talk on unit testing with pytest.

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

No Downloads
Views
Total Views
221
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Testing for people who hate testing"

  1. 1. Testing for people who hate writing tests Tips and tricks for organizing and writing simple tests with pytest.
  2. 2. Writing tests is painful ● ● ● ● what to test how to do it takes time QQ...
  3. 3. Case study User facing ● Mobile API (Bono) ● Livelovely.com (Spot) ● Pro.livelovely.com (Pearl) ● Messaging API (Ditto) ● Photo API (Jiris)
  4. 4. Organizing ● mimic application structure ○ easy to remember ○ helps scope tests ○ easy test hooks ● pytest discovery ○ http://pytest.org/latest/goodpractises. html#conventions-for-python-test-discovery
  5. 5. Theres a fixture for that... ● test fixture is a fixed state of the software under test used as a baseline for running tests; also known as the test context. ● reusable bits of code that are used to write tests. ● fixtures replace traditional setup/teardown ● fixtures can be built on top of each other
  6. 6. Request fixture
  7. 7. User fixture
  8. 8. Test using fixture
  9. 9. Interaction Fixture
  10. 10. Test using fixture
  11. 11. @linuxlewis -- @lovely http://livelovely.com sam@livelovely.com http://github.com/linuxlewis https://github.com/linuxlewis/sfpython-pytest
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×