Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Turnip
Search
kbaba1001
December 08, 2014
Technology
0
320
Turnip
TokyuRubyKaigi 08
kbaba1001
December 08, 2014
Tweet
Share
More Decks by kbaba1001
See All by kbaba1001
How to build a video conferencing system that no one has ever told you about
kbaba1001
0
43
Build React system with ClojureScript (Squint)
kbaba1001
0
120
talk-with-local-llm-with-web-streams-api
kbaba1001
0
440
Lume: Static Site Generator
kbaba1001
0
610
React_2023
kbaba1001
0
170
Word Penne
kbaba1001
0
210
I live by using a minor language
kbaba1001
1
170
fast optical line
kbaba1001
0
370
ArtPosePro and Procreate
kbaba1001
1
210
Other Decks in Technology
See All in Technology
ウェルネス SaaS × AI、1,000万ユーザーを支える 業界特化 AI プロダクト開発への道のり
hacomono
PRO
0
250
CARTAのAI CoE が挑む「事業を進化させる AI エンジニアリング」 / carta ai coe evolution business ai engineering
carta_engineering
0
2k
30分であなたをOmniのファンにしてみせます~分析画面のクリック操作をそのままコード化できるAI-ReadyなBIツール~
sagara
0
180
Strands AgentsとNova 2 SonicでS2Sを実践してみた
yama3133
0
930
初めてのDatabricks AI/BI Genie
taka_aki
0
230
子育てで想像してなかった「見えないダメージ」 / Unforeseen "hidden burdens" of raising children.
pauli
2
300
S3を正しく理解するための内部構造の読解
nrinetcom
PRO
3
200
Bedrock AgentCore Memoryの新機能 (Episode) を試してみた / try Bedrock AgentCore Memory Episodic functionarity
hoshi7_n
1
920
AWS CLIの新しい認証情報設定方法aws loginコマンドの実態
wkm2
7
760
【U/Day Tokyo 2025】Cygames流 最新スマートフォンゲームの技術設計 〜『Shadowverse: Worlds Beyond』におけるアーキテクチャ再設計の挑戦~
cygames
PRO
2
900
[デモです] NotebookLM で作ったスライドの例
kongmingstrap
0
170
Sansanが実践する Platform EngineeringとSREの協創
sansantech
PRO
2
950
Featured
See All Featured
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Leadership Guide Workshop - DevTernity 2021
reverentgeek
0
160
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
87
Bash Introduction
62gerente
615
210k
Designing for Performance
lara
610
69k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
130
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.3k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
2
60
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
1
250
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
1
110
Visualization
eitanlees
150
16k
Transcript
Turnip Turnip @kbaba1001 Powered by Rabbit 2.1.3 and COZMIXNG
自己紹介 kbaba1001 Ruby on Rails 永和システムマネジメント
kbaba1001食堂 ?
今日の話
Turnip とは Acceptance Test Framework @jnicklas (capybara、xpath)
特徴 Gherkin でシナリオテストを書く RSpec の拡張として動く Spinach より機能が多い
Gherkin フィーチャ: kbaba1001として料理を作る シナリオ: ワインシリアルを作る 前提 "ワイン" がある かつ "シリアル"
がある かつ 冷蔵庫が空である もし kbaba1001が空腹である ならば "ワインシリアル" を作ること
RSpecでのステップ定義 # spec/acceptance/steps/food_steps.rb steps_for :food do step ":name がある" do
|name| Food.create!(name: name) end end
Cucumber との比較 スコープ付きステップ 正規表現 → Placeholder
スコープ付きステップ steps_for :food do step ":name がある" do |name| Food.create!(name:
name) end end steps_for :tool do step ":name がある" do |name| Tool.create!(name: name) end end
スコープ付きステップ @food シナリオ: ワインシリアルを作る 前提 "ワイン" がある かつ "シリアル" がある
@tool シナリオ: ショートケーキを作る 前提 "電動ドリル" がある かつ "手動泡立て機" がある
Placeholder step ":food が :count ある/いる" do |food, count| end
placeholder :count do match /\d+(個|羽|丁)/ do |count| count.to_i end match(/(.+)/) {|count| 10 } end
なんか良さそう!!
プロジェクトで使ってみた Rails 期間: 1 年間 ほぼ全画面を Turnip でテスト
LOC 全体 feature s steps model spec 25,000 6,000 1,300
6,000
Turnip感想 RSpecに組み込めるのがよい 規模が大きくなるとつらい
つらみ スコープが混ざる
スコープが混ざる steps_for :food do step ":name がある" do |name| ...
steps_for :tool do step ":name がある" do |name| ... # step を重複定義するのでエラー @food @tool シナリオ: ワインシリアルを作る 前提 "ワイン" がある かつ "電動ドリル" がある
回避方法 steps_for :food do step "食べ物 :name がある" do |name|
... steps_for :tool do step "道具 :name がある" do |name| ... @food @tool シナリオ: ワインシリアルを作る 前提 食べ物 "ワイン" がある かつ 道具 "電動ドリル" がある
( ˘ω˘) スコープとは何だったのか…
つらみ Custom Step Placeholder でスコ ープが使えない placeholder :count do match
/\d+(個|羽|丁)/ do |count| count.to_i end match(/(.+)/) {|count| 10 } end
長い… placeholder :page do helper = Rails.application.routes.url_helpers match(/トップページ/) { helper.root_path
} match(/ユーザーマイページ/) { helper.authenticated_root_path } match(/管理者マイページ/) { helper.admin_authenticated_root_path } match(/プロフィール登録ページ/) { helper.profile_path } # 中略... match(/(.+)/) {|page| page } end
( ˘ω˘) スコープとは何だったのか…
Step をまとめづらい シナリオ: もし "ワインシリアル" と表示すること かつ "ヘッダー" に "ワインシリアル"
と表示すること step ':text と表示すること' do |text| expect(page).to have_content(text) end step ':parent に :text と表示すること' do |parent, text| within(parent) do send ':text と表示すること', text end end
( ˘ω˘) 正規表現は善!!
まとめ Turnip は小さいプロジェクトで RSpec の拡張として使うには手 頃。 本格的にシナリオテストを書くな ら Cucumber。 Powered
by Rabbit 2.1.3 and COZMIXNG