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
110
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
610
Code Review (Navy Hackathon)
rantav
0
83
Infrastructure Testing Using Kubernetes And Golang
rantav
0
94
Infrastructure testing using Kubernetes
rantav
0
550
Interview Workshop - Technical Questions
rantav
0
340
Code Review Best Practices
rantav
0
96
Code Review @ AppsFlyer
rantav
0
94
GraphQL at Yodas
rantav
2
170
Git for champs
rantav
0
150
Other Decks in Programming
See All in Programming
Claude Code on the Web を超える!? Codex Cloud の実践テク5選
sunagaku
0
580
AI時代もSEOを頑張っている話
shirahama_x
0
100
FlutterKaigi 2025 システム裏側
yumnumm
0
1.1k
Stay Hacker 〜九州で生まれ、Perlに出会い、コミュニティで育つ〜
pyama86
2
2.2k
モデル駆動設計をやってみよう Modeling Forum2025ワークショップ/Let’s Try Model-Driven Design
haru860
0
170
Eloquentを使ってどこまでコードの治安を保てるのか?を新人が考察してみた
itokoh0405
0
3.2k
OSS開発者の憂鬱
yusukebe
12
5.3k
複数チーム並行開発下でのコード移行アプローチ ~手動 Codemod から「生成AI 活用」への進化
andpad
0
180
Amazon Bedrock Knowledge Bases Hands-on
konny0311
0
150
Rails Girls Sapporo 2ndの裏側―準備の日々から見えた、私が得たもの / SAPPORO ENGINEER BASE #11
lemonade_37
2
180
CloudNative Days Winter 2025: 一週間で作る低レイヤコンテナランタイム
ternbusty
7
1.6k
チーム開発の “地ならし"
konifar
8
5.6k
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
A better future with KSS
kneath
239
18k
Reflections from 52 weeks, 52 projects
jeffersonlam
355
21k
Unsuck your backbone
ammeep
671
58k
Why Our Code Smells
bkeepers
PRO
340
57k
Raft: Consensus for Rubyists
vanstee
140
7.2k
KATA
mclloyd
PRO
32
15k
GraphQLとの向き合い方2022年版
quramy
49
14k
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
RailsConf 2023
tenderlove
30
1.3k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
249
1.3M
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