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
1
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
0
310
Javent - Coroutines 101
androidvip
0
330
Abangkis - INTO KOTLIN A PRAGMATIC WAY
androidvip
2
430
Henry & Meyta - Behind The Scene of Tokopedia Android Homepage
androidvip
1
580
Other Decks in Programming
See All in Programming
高度なUI/UXこそHotwireで作ろう Kaigi on Rails 2025
naofumi
4
3.9k
Catch Up: Go Style Guide Update
andpad
0
220
デミカツ切り抜きで面倒くさいことはPythonにやらせよう
aokswork3
0
230
Go言語の特性を活かした公式MCP SDKの設計
hond0413
1
230
CSC305 Lecture 03
javiergs
PRO
0
240
Range on Rails ―「多重範囲型」という新たな選択肢が、複雑ロジックを劇的にシンプルにしたワケ
rizap_tech
0
110
After go func(): Goroutines Through a Beginner’s Eye
97vaibhav
0
370
dynamic!
moro
10
7.4k
PHPに関数型の魂を宿す〜PHP 8.5 で実現する堅牢なコードとは〜 #phpcon_hiroshima / phpcon-hiroshima-2025
shogogg
1
140
CI_CD「健康診断」のススメ。現場でのボトルネック特定から、健康診断を通じた組織的な改善手法
teamlab
PRO
0
210
Le côté obscur des IA génératives
pascallemerrer
0
140
10年もののAPIサーバーにおけるCI/CDの改善の奮闘
mbook
0
810
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
79
6k
Building an army of robots
kneath
306
46k
Statistics for Hackers
jakevdp
799
220k
The Invisible Side of Design
smashingmag
301
51k
Why Our Code Smells
bkeepers
PRO
339
57k
Into the Great Unknown - MozCon
thekraken
40
2.1k
The Cult of Friendly URLs
andyhume
79
6.6k
We Have a Design System, Now What?
morganepeng
53
7.8k
What’s in a name? Adding method to the madness
productmarketing
PRO
23
3.7k
Building a Scalable Design System with Sketch
lauravandoore
463
33k
Reflections from 52 weeks, 52 projects
jeffersonlam
352
21k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.6k
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