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
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
21
7.3k
IFSによる形状設計/デモシーンの魅力 @ 慶應大学SFC
gam0022
1
310
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
360
Oxlint JS plugins
kazupon
1
970
高速開発のためのコード整理術
sutetotanuki
1
400
Patterns of Patterns
denyspoltorak
0
1.4k
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
620
AI によるインシデント初動調査の自動化を行う AI インシデントコマンダーを作った話
azukiazusa1
1
740
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
270
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
130
Featured
See All Featured
Producing Creativity
orderedlist
PRO
348
40k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
830
Google's AI Overviews - The New Search
badams
0
910
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
1.9k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
110
Fashionably flexible responsive web design (full day workshop)
malarkey
408
66k
Making the Leap to Tech Lead
cromwellryan
135
9.7k
Automating Front-end Workflow
addyosmani
1371
200k
Scaling GitHub
holman
464
140k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
0
1.1k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
3.9k
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