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
460
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
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
7
2.8k
AtCoder Conference 2025
shindannin
0
1.1k
プロダクトオーナーから見たSOC2 _SOC2ゆるミートアップ#2
kekekenta
0
220
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
130
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
580
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
210
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
710
CSC307 Lecture 03
javiergs
PRO
1
490
高速開発のためのコード整理術
sutetotanuki
1
400
Vibe Coding - AI 驅動的軟體開發
mickyp100
0
180
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
320
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
54
8k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
250
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
How to Talk to Developers About Accessibility
jct
2
130
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
150
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
270
[SF Ruby Conf 2025] Rails X
palkan
1
760
How to build a perfect <img>
jonoalderson
1
4.9k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
180
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
Paper Plane
katiecoart
PRO
0
46k
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