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
KotlinTest with Spring Boot
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Takehata Naoto
January 21, 2019
Programming
1.9k
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
KotlinTest with Spring Boot
2019年1月21日 「集まれKotlin好き!Kotlin愛好会 vol7」の談義資料です。
Takehata Naoto
January 21, 2019
More Decks by Takehata Naoto
See All by Takehata Naoto
AI時代でも変わらない技術コミュニティの力~10年続く“ゆるい”つながりが生み出す価値
n_takehata
2
1.2k
KotlinConf 2025で発表された言語のアップデートと現地参加レポート
n_takehata
2
390
KotlinConf 2025 現地で感じたServer-Side Kotlin
n_takehata
2
500
KotlinConf 2025 現地参加の土産話
n_takehata
0
220
組織貢献をするフリーランスエンジニアという生き方
n_takehata
1
6.5k
「2024年版 Kotlin サーバーサイドプログラミング実践開発」の補講 〜O/Rマッパー編〜
n_takehata
2
820
2024年版 Kotlin サーバーサイドプログラミング実践開発
n_takehata
9
9k
Server-Side目線で見る、Kotlin Festの楽しみ方
n_takehata
0
650
KotlinとCloud Vision APIで領収書の電子帳簿保存法対応をする
n_takehata
1
2k
Other Decks in Programming
See All in Programming
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
190
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
230
任せる範囲はこう広がった / How the Scope of AI Delegation Has Expanded
nrslib
1
250
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
580
えっ!!コードを読まずに開発を!?
hananouchi
0
190
霧の中の代数的エフェクト
funnyycat
1
350
【やさしく解説 設計編 #0】DDDのコード、読めるのに分からない人へ
panda728
PRO
2
260
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
2
840
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
180
Welcome to the "Parametricity" 🏙️ − Generic だけど Specific な世界 −
guvalif
PRO
1
150
20260623_Loop Engineeringで自分の分身の問い合わせBotを作る
ryugen04
0
200
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
120
Featured
See All Featured
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.4k
Optimizing for Happiness
mojombo
378
71k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Darren the Foodie - Storyboard
khoart
PRO
3
3.4k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
170
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
55k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
190
Producing Creativity
orderedlist
PRO
348
40k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
220
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
150
Transcript
: Twi%er:@n_takehata %)& +,#,!Kotlin +', $*,( +*"11
+
• Kotlin • Spring Boot • MyBatis
• KotlinTest • Gradle • gRPC
• Kotlin • Spring Boot • MyBatis
• KotlinTest • Gradle • gRPC
1 1 2 B 1 1 . 1 4
3
1 1 2 B 1 1 . 1 4
3
• / • : • K : //
. / / / ./ / / ./
testCompile('io.kotlintest:kotlintest-runner-junit5:3.1.7')
• •
•
( class SampleServiceForStringSpecTest : StringSpec() { init { val service
= SampleService() "execute param 1 one " { service.execute(1) shouldBe "one" } • • shouldBe KotlinTest
• FB • ) F FB • ( S
( class SampleServiceForBehaviorSpecTest : BehaviorSpec() { init { val service
= SampleService() given("execute") { `when`("param1 ") { val result = service.execute(1) then("one ") { result.shouldBe("one") }
• D • ( e B • 3 K
)( `
) ((
( class SampleServiceForAnnotationSpecTest : AnnotationSpec() { val service = SampleService()
@Test fun param1one() { service.execute(1) shouldBe "one" }
• KT @ U • J
• ( ) • K1 • K0
1 1 2 B 1 1 . 1 4
3
• •
class SampleServiceTest: StringSpec() { init { forall(
row(10, ""), row(100, "") ) { num, descrip8on -> "execute param ${descrip8on} " { val service = SampleService() service.execute(num) shouldBe true } } } }
• 1 • 1 • 1
class SampleServiceForStringSpecTest : StringSpec() { init { val service
= SampleService() "executeparam1one" { service.execute(1) shouldBe "one" } "f:executeparam2two" { service.execute(2) shouldBe "two" } } }
) (( 1
class SampleServiceForStringSpecTest : StringSpec() { init { val service
= SampleService() "executeparam1one" { service.execute(1) shouldBe "one" } "!executeparam2two" { service.execute(2) shouldBe "two" } } } !
) (( 2
• B • •
1 1 2 B 1 1 . 1 4
3
None
@ContextConfiguration(classes = [TestApplicationContext::class]) class UserServiceImplTest( private val userService:
UserService ): StringSpec() { init { ”getUserStatushogefuga" { // } } }
testCompile("io.kotlintest:kotlintest-extensions-spring:3.1.8")
package io.kotlintest.provided import io.kotlintest.AbstractProjectConfig import io.kotlintest.extensions.ProjectLevelExtension
import io.kotlintest.spring.SpringAutowireConstructorExtension class ProjectConfig : AbstractProjectConfig() { override fun extensions(): List<ProjectLevelExtension> = listOf(SpringAutowireConstructorExtension) } • AbstractProjectConfig • ConstructorInjection
package io.kotlintest.provided import io.kotlintest.AbstractProjectConfig import io.kotlintest.extensions.ProjectLevelExtension
import io.kotlintest.spring.SpringAutowireConstructorExtension class ProjectConfig : AbstractProjectConfig() { override fun extensions(): List<ProjectLevelExtension> = listOf(SpringAutowireConstructorExtension) } • io.kotlintest.provided • ProjectConfig •
1 1 2 B 1 1 . 1 4
3
• # $)" • (%*
• &+'!
B B 8 2 8 2 / 8 2 9:2
0 88 K S T 1 9 - 80 99 2-8 .8 9 2 / 2 0 2 8 2 9:2 0-88 2 1 8 2 / 8 2 / K 9/.K 1 9 - 80 /1 / 02 //: .8 / : : 8 2 / 9/.
201924 Java→Kotlin https://gihyo.jp/magazine/SD/archive/2019/201902