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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Takehata Naoto
January 21, 2019
Programming
1.8k
3
Share
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
1k
KotlinConf 2025で発表された言語のアップデートと現地参加レポート
n_takehata
2
370
KotlinConf 2025 現地で感じたServer-Side Kotlin
n_takehata
2
450
KotlinConf 2025 現地参加の土産話
n_takehata
0
200
組織貢献をするフリーランスエンジニアという生き方
n_takehata
1
6.2k
「2024年版 Kotlin サーバーサイドプログラミング実践開発」の補講 〜O/Rマッパー編〜
n_takehata
2
810
2024年版 Kotlin サーバーサイドプログラミング実践開発
n_takehata
9
8.8k
Server-Side目線で見る、Kotlin Festの楽しみ方
n_takehata
0
620
KotlinとCloud Vision APIで領収書の電子帳簿保存法対応をする
n_takehata
1
1.9k
Other Decks in Programming
See All in Programming
属人化しないコード品質の作り方_2026.04.07.pdf
muraaano
0
330
My daily life on Ruby
a_matsuda
3
200
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
160
クラウドネイティブなエンジニアに向ける Raycastの魅力と実際の活用事例
nealle
2
250
Agentic UI in the Frontend: Architectures with Open Standards @JAX 2026 in Mainz
manfredsteyer
PRO
0
110
Are We Really Coding 10× Faster with AI?
kohzas
0
140
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
1
680
Road to RubyKaigi: Play Hard(ware)
makicamel
1
560
Agent Skills を社内で育てる仕組み作り
jackchuka
1
1.8k
Symfony AI in Action - SymfonyLive Berlin 2026
chr_hertel
1
140
[RubyKaigi 2026] Require Hooks
palkan
1
310
ソースコード→AST→オペコード、の旅を覗いてみる
o0h
PRO
1
130
Featured
See All Featured
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
How to Ace a Technical Interview
jacobian
281
24k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
340
Reality Check: Gamification 10 Years Later
codingconduct
0
2.1k
YesSQL, Process and Tooling at Scale
rocio
174
15k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
We Are The Robots
honzajavorek
0
220
Designing Experiences People Love
moore
143
24k
Navigating Team Friction
lara
192
16k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.4k
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