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
今更JUnit4を勉強する
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
shiryu
October 20, 2023
Programming
140
0
Share
今更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
88
ゆるゆるJava第二回「第一回でのつまづきと復習ラムダ式」
shiryu
0
34
JJUG CCC Fall 2023 若手こそテストを書こう!
shiryu
2
200
2023/08/26 むきむきJava GithubActions+GCP+自動デプロイ(他山の石ver)
shiryu
1
160
2023/08/31 JJUG LT会 初登壇から学んだ一つのこと
shiryu
0
120
Other Decks in Programming
See All in Programming
TypeScriptだけでAIエージェントを作る フロント・エージェント・インフラのフルスタック実践
har1101
1
360
My daily life on Ruby
a_matsuda
3
400
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
200
ハーネスエンジニアリングとは?
kinopeee
13
7k
GitHubCopilotCLIをはじめよう.pdf
htkym
0
330
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
0
180
Surviving Black Friday: 329 billion requests with Falcon!
ioquatix
0
3.2k
🦞OpenClaw works with AWS
licux
1
370
PHPer、Cloudflare に引っ越す
suguruooki
2
220
From Formal Specification to Property Based Test
ohbarye
0
2.6k
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
3
1.1k
ついに来た!本格的なマルチクラウド時代の Google Cloud
maroon1st
0
440
Featured
See All Featured
Music & Morning Musume
bryan
47
7.2k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
500
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
61
44k
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
390
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.9k
Building the Perfect Custom Keyboard
takai
2
760
WCS-LA-2024
lcolladotor
0
590
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.3k
Between Models and Reality
mayunak
4
290
Agile that works and the tools we love
rasmusluckow
331
21k
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の期限切れそうだけど)