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
今更JUnit4を勉強する
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
shiryu
October 20, 2023
Programming
160
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
今更JUnit4を勉強する
なるべくJUnit5を勉強しましょう。
むきむきJavaで発表した資料です。
https://java-trainees.connpass.com/event/293679/
shiryu
October 20, 2023
More Decks by shiryu
See All by shiryu
JJUG_CFPの書き方について
shiryu
0
100
ゆるゆるJava第二回「第一回でのつまづきと復習ラムダ式」
shiryu
0
45
JJUG CCC Fall 2023 若手こそテストを書こう!
shiryu
2
210
2023/08/26 むきむきJava GithubActions+GCP+自動デプロイ(他山の石ver)
shiryu
1
170
2023/08/31 JJUG LT会 初登壇から学んだ一つのこと
shiryu
0
120
Other Decks in Programming
See All in Programming
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
630
When benchmarks go bad - what I learned from measuring performance wrong
hollycummins
0
160
Rでドレミ/Do-Re-Mi_with_R
florets1
0
120
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
480
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
Ghostty + Neovimで作る 透明でカッコ良い開発環境
j341nono
0
150
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.9k
すこし踏み込む CancellationToken
htkym
2
1.6k
Security issues being discussed on Web Platforms
petamoriken
0
1.4k
The Rails Doctrine Decade
koic
2
510
AIに “答え“を書かせるのを やめてみた
___akari11
0
110
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
200
Featured
See All Featured
Ethics towards AI in product and experience design
skipperchong
2
410
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
350
How to Talk to Developers About Accessibility
jct
2
560
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
910
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.8k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
320
How to make the Groovebox
asonas
2
2.5k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Typedesign – Prime Four
hannesfritz
42
3.2k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Transcript
今更JUnit4を勉強する
今日伝えたいこと 勉強したい分野の本が古くても、 とりあえず読んでみた方がよさそう 対象者 : 新しいものをやらなきゃいけない気がする新人エンジニア
自己紹介 2023卒エンジニア - むきむきJava主催 - 23歳✌✌👍 - 大学時代は東北で過ごす - つよくない(非情報系)
- @shiryu_go Shiryu
経緯 JUnitの勉強したかったけど 出てきた本が全部JUnit4 そもそも、テストの書き方の前に テストってなんなのか知るのが重要なのでは
その前に:JUnit4,5の違い パッケージ JUnit4 : org.junit.* JUnit5 : org.junit.jupiter.* 例 :
org.junit.Test→org.junit.jupiter.api.Test アノテーション JUnit4 : @Test(expected = Exception.class) JUnit5 : Assertions.assertThrows(Exception.class, () -> {//...});
テストで重要っぽいこと ①FIRST(失敗しないテストの原則) ②Right-BICEP(テストの対象の選び方) ③CORRECT(テストで考慮するべき境界条件) 前提 : 完璧なテストは存在しない
テストの考え方① FIRST(失敗しないテストの原則) - Fast(迅速) - Isolated(隔離) - Repeatable(繰り返し可能) - Self-validating(自律的検証)
- Timely(タイムリー)
テストの考え方② Right-BICEP(テストの対象の選び方) - Right(結果は正しいか) - Boundary(境界) - Inverse(別の関係をチェック可能か) - Cross-Check(別の方法を使って結果をチェック可能か)
- Error(エラーの条件を強制的に発生させられるか) - Performance(特性は許容範囲か)
テストの考え方③ CORRECT(テストで考慮するべき境界条件) - Conformance(形への適合) - Ordering(順序) - Range(範囲) - Reference(参照)
- Existance(存在) - Cardinally(要素数) - Time(時間)
JUnitの年表 Javaの年表 1997 : JUnit 1 Release ???? : JUnit2
Release ???? : JUnit3 Release 2006 : JUnit 4 Release 2017 : JUnit5 Release 1997 : JDK 1.1 2002 : J2SE1.4 2004 : Java SE5 2006 : Java SE6 2008 : J2SEサポ終了 2017 : Java9 JDKのVer = JavaのVer
2001年 : アジャイル宣言(アジャイル開発発祥) 2003年 : テスト駆動開発(TDD) 2006年 : ビヘイビア駆動開発(TDD派生) 2009年
: DevOps →今なんとなく耳にする言葉の発祥は、割と古い
まとめ - 結果 - 境界条件 - 関係性 - エラー条件が正確か等々を確かめる...etc Verが低くても必要なことは多分学べる
おわり
参考図書 実践 JUnit JUnit実践入門
会場内での補足 - できる限り新しい本を読むべき - 今後、日本語での本は出なくなっていく。 - 英語での本は発売される - Java8以降であれば現状ギリギリ活かせる (そもそもJava8がLTSの期限切れそうだけど)