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
How we test our projects
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Terry
November 18, 2012
Programming
1.9k
29
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
How we test our projects
Rubyconf China 2012
Terry
November 18, 2012
More Decks by Terry
See All by Terry
Building API For The REST of Us
poshboytl
8
750
RubyConf China Welcome Slides
poshboytl
1
95
Rails Girls Chengdu 2014
poshboytl
2
340
Refactoring Re-education
poshboytl
5
990
Other Decks in Programming
See All in Programming
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
190
Webフレームワークの ベンチマークについて
yusukebe
0
180
PHPで使える日時の表現と、その知り方 #frontend_phpcon_do
o0h
PRO
0
270
TSKaigi Night Talks 2026_TypeScriptでサプライチェーンの整合性を型に閉じ込める
geekplus_tech
0
410
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
0
140
AIキャラアプリkaiwaの低遅延音声通話基盤をどう作ったか - AWS Gravitonで支える低遅延・低コストAI Agent基盤
mogamit
0
110
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
220
LLM本来の能力を解き放つサンドボックス技術とAI民主化への適用
yukukotani
3
4.6k
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
850
技術的負債解消で開発者の未来を開く- AIの力でコード刷新
kmd2kmd
0
120
代数的データ型って何が嬉しいの? #frontend_phpcon_do
kajitack
8
3.8k
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
1
460
Featured
See All Featured
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
170
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.8k
Leo the Paperboy
mayatellez
7
1.9k
Abbi's Birthday
coloredviolet
3
8.3k
GraphQLとの向き合い方2022年版
quramy
50
15k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
350
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.7k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.8k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
Rebuilding a faster, lazier Slack
samanthasiow
85
9.5k
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.5k
Agile that works and the tools we love
rasmusluckow
331
22k
Transcript
None
whoami
None
太檑
Terry
@poshboytl
Co-founder of Pragmatic.ly
None
Creator of Railscasts-china.com
None
Survey
How many people write tests?
How many people use RSpec?
Tools we use
None
I love RSpec!
None
None
Bad boy!
None
x.should == y
None
None
Straightforward!
asset_equal y, x
None
None
This is just right!
Pillow War!
Peace! Choose what you like!
Try it, instead of following anybody.
Syntax
Syntax Sugar
Syntax Sugar DSL
Is syntax important?
None
None
None
Syntax is important, that’s the most important reason why we
love Ruby! It also can be the reason we love RSepc!
Syntax is important, that’s the most important reason why we
love Ruby! It also can be the reason we love RSepc! Terry Tai
Let’s talk about RSpec!
Our practices
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
None
Setup phase contains two parts use ‘let’ to initialize data
‘before’ block to do some actions
None
None
None
None
None
None
None
None
Why straightforward is important for us?
None
None
None
The sugar we don’t like very much
None
None
None
RSpec done
None
Problem of Fixtures
Hard to read Hard to write Hard to maintain
None
None
What’s the password?
What’s the password?
What’s the password? Add new records?
Fixtures separate the data and the tests
None
None
Bullshit!
None
What’s the advantage of fixtures?
It’s really fast!!
Some practices for Factory Girl
None
None
None
None
None
None
None
None
Random data is a advantage of factory to fixtures
None
Update: If you wanna use LoremIpsum class still need the
gems like forgery or lorem-ipsum.
None
None
None
None
None
None
How we run tests?
You might see this
But...... I really don’t use it
Tell you a secret
I run my tests manually
Why?
probably, I type :w so frequently and quickly. LOL
probably, I type :w so frequently and quickly. LOL
None
None
None
Your APM should be high
Slayers Boxer Your APM should be high
Manually run ‘bundle exec rspec spec’ ?
No. It depends.
None
None
bundle exec rspec spec ruby -S rspec spec
Bundler still need time to load
When I can not use ‘bundle exec’ ?
None
None
no spec_helper
Two ways to run tests?
None
None
ruby -S rspec spec ?
bundle exec rspec spec ? ruby -S rspec spec ?
by Gray Bernhardt
None
About integration test
RSpec + Capybara(webkit)
Poltergeist looks nice will give it a try
I don’t love it so far Also don’t hate it
Still keep looking
Stub as little as possible only do for Current time
HTTP visiting ...
VCR
None
Use different fixture data in integration and unit tests
Integration tests are not for driving development
No mock or stub means slow You can use a
CI server run it for you
if project.open_source?
A hosted continuous integration service for the open source community.
else
None
integrity • light weight • It built by ruby (Means
you can hack!!!) • Works pretty well with git • Hook and API is weak
None
Hudson and Jenkins • They built by JAVA • Heavy
weight and powerful • a lot of plugins(git, github, emails, hipchat...) • Have nice API
We really did some interesting things with Hudson by HUBOT
http://terrytai.com/
JS tests
None
None
jasminerice gem for work with Rails asset pipeline
jasmine-sinon
None
By Ian: https://gist.github.com/4059889
None
None
None
None
None
Look at me, Terry. It’s not a JS conf, ok?
I’d better stop here
Oh, BTW
DHH is the hero in my heart
Thank you!