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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
290
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
470
並行開発のためのコードレビュー
miyukiw
0
250
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
340
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
2.6k
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
180
Fluid Templating in TYPO3 14
s2b
0
130
CSC307 Lecture 03
javiergs
PRO
1
490
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
Architectural Extensions
denyspoltorak
0
290
Lambda のコードストレージ容量に気をつけましょう
tattwan718
0
130
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
620
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
66
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
190
Designing Powerful Visuals for Engaging Learning
tmiket
0
240
It's Worth the Effort
3n
188
29k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Context Engineering - Making Every Token Count
addyosmani
9
660
Ethics towards AI in product and experience design
skipperchong
2
190
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.2k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
SEO for Brand Visibility & Recognition
aleyda
0
4.2k
Discover your Explorer Soul
emna__ayadi
2
1.1k
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