Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
コンポーネントテストの戦略について
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
issei1213
July 14, 2023
1
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
コンポーネントテストの戦略について
issei1213
July 14, 2023
Transcript
14 slides
コンポーネントテストの戦略について issei1213
About me 名前:issei1213(三浦 壱生) 所属会社:合同会社ノマドリ 技術スタック:React / Vue.js / TypeScript
好きな言語:TypeScript
冗談はさておき、アジェンダ - なぜこのタイトルを話そうと思ったのか - Avoid Nesting when you're Testingの概要 -
テストサンプルコード - 感想
なぜこのタイトルを話そうとおもっ たのか - 書籍「フロント開発のためのテスト入門」の中で紹介されていた記 事があり、とても感動したので共有したかった。 - 「Avoid Nesting when you're
Testing(テスト中のネスティングを避 ける)」という内容の記事だが、コンポーネントテストの書き方が非常 に参考になる。
Avoid Nesting when you're Testingの概要 - 過度な抽象化をやめる - - -
beforeEachやletなどを使って過度に抽象化すると可読性が悪くなる ネストをやめる - 変数が多くなり追跡作業が増えてしまう - 変数の再割当てを避けるべき 上記を実施するために、AHA Testingを行う - Avoid Hasty Abstraction(性急な抽象化を避ける)の略
テストサンプルコード①(テスト対象) 実際のDOM
テストサンプルコード②(Jest) 問題:このテストコードの問題点はわかりますか?
テストサンプルコード③(問題点)
テストサンプルコード④(問題点) では、どうするか?
インライン化しちゃう 重複コードが増えてしまう。。。
AHA Testingを適用
実際のテストケース
感想 - コンポーネントテストの書き方がいまいち分からなかったため、大変に参考 になった - setup関数は人によって書き方が変わりそうなので、一度チーム全体で共通 認識を作る必要がありそう - コンポーネントテストで迷っている人は、今回紹介した記事を一度みてみる と温度感はつかめるかなと思った
参考記事 - Avoid Nesting when you're Testing - AHA Testing
💡 - フロントエンド開発のためのテスト入門 今からでも知っておきたい自動テ スト戦略の必須知識 - https://www.shoeisha.co.jp/book/detail/9784798178639
More Decks by issei1213
See All by issei1213
AI時代の理解アプローチ
issei_miura
0
1
Compound Pattern紹介
issei_miura
0
2
SolidでLeacTion!をリプレイスしてみた!
issei_miura
0
2
Featured
See All Featured
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
330
Prompt Engineering for Job Search
mfonobong
0
610
The Cult of Friendly URLs
andyhume
79
7.1k
Believing is Seeing
oripsolob
1
290
How to Think Like a Performance Engineer
csswizardry
28
3k
Exploring anti-patterns in Rails
aemeredith
4
580
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.6k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
640
Reflections from 52 weeks, 52 projects
jeffersonlam
356
22k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
630
Mind Mapping
helmedeiros
1
460