Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Testing @socialstudios.tv
Search
Ran Tavory
December 27, 2012
Programming
0
100
Testing @socialstudios.tv
An introduction talk to testing.
Really high level. Some best practices etc.
Python and JavaScript
Ran Tavory
December 27, 2012
Tweet
Share
More Decks by Ran Tavory
See All by Ran Tavory
go-grpc-channelz: a Go based UI for gRPC's channelz
rantav
0
520
Code Review (Navy Hackathon)
rantav
0
51
Infrastructure Testing Using Kubernetes And Golang
rantav
0
63
Infrastructure testing using Kubernetes
rantav
0
500
Interview Workshop - Technical Questions
rantav
0
310
Code Review Best Practices
rantav
0
65
Code Review @ AppsFlyer
rantav
0
62
GraphQL at Yodas
rantav
2
170
Git for champs
rantav
0
140
Other Decks in Programming
See All in Programming
DRFを少しずつ オニオンアーキテクチャに寄せていく DjangoCongress JP 2025
nealle
2
280
ソフトウェアエンジニアの成長
masuda220
PRO
12
2.1k
読まないコードリーディング術
hisaju
0
110
CloudNativePGを布教したい
nnaka2992
0
120
Ça bouge du côté des animations CSS !
goetter
2
160
Boost Performance and Developer Productivity with Jakarta EE 11
ivargrimstad
0
970
コードを読んで理解するko build
bells17
1
110
iOSでQRコード生成奮闘記
ktcryomm
2
110
自力でTTSモデルを作った話
zgock999
0
110
第3回関東Kaggler会_AtCoderはKaggleの役に立つ
chettub
3
1.2k
pylint custom ruleで始めるレビュー自動化
shogoujiie
0
160
XStateを用いた堅牢なReact Components設計~複雑なClient Stateをシンプルに~ @React Tokyo ミートアップ #2
kfurusho
1
990
Featured
See All Featured
Unsuck your backbone
ammeep
669
57k
Fantastic passwords and where to find them - at NoRuKo
philnash
51
3k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
129
19k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
4
380
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Building a Scalable Design System with Sketch
lauravandoore
461
33k
Stop Working from a Prison Cell
hatefulcrawdad
268
20k
Java REST API Framework Comparison - PWX 2021
mraible
29
8.4k
Speed Design
sergeychernyshev
27
810
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
27
1.9k
The Pragmatic Product Professional
lauravandoore
32
6.4k
Navigating Team Friction
lara
183
15k
Transcript
Testing @socialstudios.tv Thursday, December 27, 12
Debugging Sucks Testing Rocks Thursday, December 27, 12
Types of tests unit tests functional tests integration tests behavioral
tests UI testing monkey testing stress testing smoke testing usability testing production testing ... Thursday, December 27, 12
Today’s Focus: Unit Tests Thursday, December 27, 12
The nice thing Testable == Readable == Reusable == Documented
== Modular == Robust == Maintainable Thursday, December 27, 12
Observation: Tests == Documentation Good tests document the code they
are testing If the test passes ⇒ Documentation is up to date They also server as examples Thursday, December 27, 12
TDD 1. Write test first 2. Test fails 3. Write
code 4. Test passes 5. Commit Red - Green testing Thursday, December 27, 12
Good tests are Repeatable Fast Short Test only one thing
High coverage Thursday, December 27, 12
Bad test are Slow Depend on externals (fb, other websites,
db) Require a lot of setup Sometimes pass, sometimes fail Produce a lot of output Have exceptions in the log Thursday, December 27, 12
Side Effects are hard to test Good: def f(x): return
x * 2 Bad: def g(x): self.y = x * 2 Thursday, December 27, 12
Hard to test global variables current time / timing dependent
impl untested assumption (such as file load ordering) External state (database) Thursday, December 27, 12
External dependencies How do you test facebook? How do you
test a DAO (data access object) Thursday, December 27, 12
Mocks Use mocks (spies) instead of externals Thursday, December 27,
12
UI Testing It’s hard ⇒ only if you must! Use
selenium? We have to think about this... Thursday, December 27, 12
JavaScript: Jasmine Thursday, December 27, 12
Python: unittest2 + nose Thursday, December 27, 12
CI Server I’ll work on it... Thursday, December 27, 12
test.sh A single file to run them all Thursday, December
27, 12
Every Commit must be tested New code: TDD or not
it’s your choice. But you have to submit tested code Legacy code: First wrap with tests Then modify Thursday, December 27, 12
Resources http://googletesting.blogspot.com http://docs.python.org/2/library/ doctest.html http://pivotal.github.com/jasmine/ http://www.voidspace.org.uk/python/ mock/ Thursday, December 27,
12