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
480
Code Review (Navy Hackathon)
rantav
0
49
Infrastructure Testing Using Kubernetes And Golang
rantav
0
61
Infrastructure testing using Kubernetes
rantav
0
490
Interview Workshop - Technical Questions
rantav
0
300
Code Review Best Practices
rantav
0
61
Code Review @ AppsFlyer
rantav
0
61
GraphQL at Yodas
rantav
2
170
Git for champs
rantav
0
140
Other Decks in Programming
See All in Programming
最新TCAキャッチアップ
0si43
0
140
Click-free releases & the making of a CLI app
oheyadam
2
120
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
430
とにかくAWS GameDay!AWSは世界の共通言語! / Anyway, AWS GameDay! AWS is the world's lingua franca!
seike460
PRO
1
860
PHP でアセンブリ言語のように書く技術
memory1994
PRO
1
170
Pinia Colada が実現するスマートな非同期処理
naokihaba
4
220
Better Code Design in PHP
afilina
PRO
0
130
[Do iOS '24] Ship your app on a Friday...and enjoy your weekend!
polpielladev
0
100
Make Impossible States Impossibleを 意識してReactのPropsを設計しよう
ikumatadokoro
0
170
cmp.Or に感動した
otakakot
3
160
macOS でできる リアルタイム動画像処理
biacco42
9
2.4k
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
120
Featured
See All Featured
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
131
33k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
44
6.8k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
KATA
mclloyd
29
14k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
Writing Fast Ruby
sferik
627
61k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
A designer walks into a library…
pauljervisheath
204
24k
Documentation Writing (for coders)
carmenintech
65
4.4k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
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