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
Gilang - Playing Unit Test with Spek
Search
Android VIP
January 12, 2019
Programming
2
450
Gilang - Playing Unit Test with Spek
Android VIP
January 12, 2019
Tweet
Share
More Decks by Android VIP
See All by Android VIP
Ghiyats Hanif - Android Templates
androidvip
1
320
Javent - Coroutines 101
androidvip
1
330
Abangkis - INTO KOTLIN A PRAGMATIC WAY
androidvip
3
440
Henry & Meyta - Behind The Scene of Tokopedia Android Homepage
androidvip
2
600
Other Decks in Programming
See All in Programming
React 19でつくる「気持ちいいUI」- 楽観的UIのすすめ
himorishige
11
5.5k
CSC307 Lecture 02
javiergs
PRO
1
760
高速開発のためのコード整理術
sutetotanuki
0
120
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
810
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
240
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
380
Python札幌 LT資料
t3tra
7
1.1k
gunshi
kazupon
1
140
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
140
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
360
re:Invent 2025 トレンドからみる製品開発への AI Agent 活用
yoskoh
0
670
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
530
Featured
See All Featured
4 Signs Your Business is Dying
shpigford
187
22k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2k
GraphQLの誤解/rethinking-graphql
sonatard
74
11k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
Scaling GitHub
holman
464
140k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
420
Build The Right Thing And Hit Your Dates
maggiecrowley
38
3k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Rails Girls Zürich Keynote
gr2m
95
14k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
130
Transcript
Playing Unit Test with Spek Gilang Ramadhan Android Developer at
Dicoding
Gilang Ramadhan Android Developer at Dicoding
[email protected]
Do we need to do a test?
Application Development Cycle Specifications of the application Write the codes
Test the application manually
New Feature New Bugs . . . https://gph.is/2jt9RvW
And then . . . Automatic Testing such as unit
testing and instrumentation testing. • Write the main code • Write the test code
TDD (Test Driven Development) is an application development method developed
by testing. • Writing Tests • Running Tests • Write down the Code • Running Tests • Refactor Code
Advantages of using TDD • More Productive • Code is
neater • Safer Refactoring • Minimizing Bugs • Documentation
Understand the Testing Pyramid Illustrates how your app should include
the three categories of tests: small, medium, and large https://developer.android.com/training/testing/fundamentals
Unit Testing? Unit Testing is useful for testing code logic
in our application.
Example UnitTest
Spek Spek is a specification framework that allows you to
easily define specifications in a clear, understandable, human readable way. https://spekframework.org
Style of Spek • given, on, it • describe, it
given, on, It • name = name of class •
given = context • on = action • it = actual test
example
describe, it • name = name of class • describe
= context • it = actual test
example
Setting up • org.jetbrains.spek:spek-api:1.1.5 • org.jetbrains.spek:spek-junit-platform-engine:1.1.5 • org.junit.platform:junit-platform-runner:1.0.0 @RunWith(JUnitPlatform::class) class
CalculatorSpec: Spek({ ... })
And then . . .
And then . . .
Migrating to Spek 2.x from 1.x testImplementation 'org.spekframework.spek2:spek-dsl-jvm:2.0.0-rc.1' testImplementation 'org.spekframework.spek2:spek-runner-junit5:2.0.0-rc.1'
Style of Spek 2.x • given, on, it • describe,
context, it
Let’s try https://github.com/gilangadhan/SpekFramework
Terima Kasih