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
Terry
November 18, 2012
Programming
29
1.9k
How we test our projects
Rubyconf China 2012
Terry
November 18, 2012
Tweet
Share
More Decks by Terry
See All by Terry
Building API For The REST of Us
poshboytl
8
730
RubyConf China Welcome Slides
poshboytl
1
87
Rails Girls Chengdu 2014
poshboytl
2
320
Refactoring Re-education
poshboytl
5
980
Other Decks in Programming
See All in Programming
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
590
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
100
從冷知識到漏洞,你不懂的 Web,駭客懂 - Huli @ WebConf Taiwan 2025
aszx87410
2
3.4k
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
1.9k
Fragmented Architectures
denyspoltorak
0
130
クラウドに依存しないS3を使った開発術
simesaba80
0
230
副作用をどこに置くか問題:オブジェクト指向で整理する設計判断ツリー
koxya
1
540
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
130
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
130
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
150
.NET Conf 2025 の興味のあるセッ ションを復習した / dotnet conf 2025 quick recap for backend engineer
tomohisa
0
120
Claude Codeの「Compacting Conversation」を体感50%減! CLAUDE.md + 8 Skills で挑むコンテキスト管理術
kmurahama
1
780
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
231
22k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
Ethics towards AI in product and experience design
skipperchong
2
180
Raft: Consensus for Rubyists
vanstee
141
7.3k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
85
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Stop Working from a Prison Cell
hatefulcrawdad
273
21k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
100
Rebuilding a faster, lazier Slack
samanthasiow
85
9.4k
So, you think you're a good person
axbom
PRO
2
1.9k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
260
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!