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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
630
Code Review (Navy Hackathon)
rantav
0
97
Infrastructure Testing Using Kubernetes And Golang
rantav
0
110
Infrastructure testing using Kubernetes
rantav
0
580
Interview Workshop - Technical Questions
rantav
0
360
Code Review Best Practices
rantav
0
110
Code Review @ AppsFlyer
rantav
0
110
GraphQL at Yodas
rantav
2
180
Git for champs
rantav
0
170
Other Decks in Programming
See All in Programming
Ruby and LLM Ecosystem 2nd
koic
1
950
生成 AI 時代のスナップショットテストってやつを見せてあげますよ(α版)
ojun9
0
250
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
560
20260313 - Grafana & Friends Taipei #1 - Kubernetes v1.36 的開發雜記:那些困在 Alpha 加護病房太久的 Metrics
tico88612
0
210
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
160
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
100
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.4k
CSC307 Lecture 14
javiergs
PRO
0
470
The Ralph Wiggum Loop: First Principles of Autonomous Development
sembayui
0
3.7k
へんな働き方
yusukebe
0
830
脱 雰囲気実装!AgentCoreを良い感じにWEBアプリケーションに組み込むために
takuyay0ne
2
270
AHC061解説
shun_pi
0
390
Featured
See All Featured
First, design no harm
axbom
PRO
2
1.1k
Marketing to machines
jonoalderson
1
5k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
85
Docker and Python
trallard
47
3.8k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
200
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
Making the Leap to Tech Lead
cromwellryan
135
9.8k
BBQ
matthewcrist
89
10k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
55k
The Language of Interfaces
destraynor
162
26k
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