Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
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
320
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
590
Other Decks in Programming
See All in Programming
ゲームの物理 剛体編
fadis
0
280
AIコーディングエージェント(NotebookLM)
kondai24
0
150
愛される翻訳の秘訣
kishikawakatsumi
1
270
CSC509 Lecture 14
javiergs
PRO
0
220
Socio-Technical Evolution: Growing an Architecture and Its Organization for Fast Flow
cer
PRO
0
300
関数実行の裏側では何が起きているのか?
minop1205
1
650
スタートアップを支える技術戦略と組織づくり
pospome
8
15k
俺流レスポンシブコーディング 2025
tak_dcxi
13
8.2k
GeistFabrik and AI-augmented software development
adewale
PRO
0
280
CloudNative Days Winter 2025: 一週間で作る低レイヤコンテナランタイム
ternbusty
7
2k
ソフトウェア設計の課題・原則・実践技法
masuda220
PRO
26
22k
ViewファーストなRailsアプリ開発のたのしさ
sugiwe
0
420
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
141
7.2k
Building Adaptive Systems
keathley
44
2.9k
Optimizing for Happiness
mojombo
379
70k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
970
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.8k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Into the Great Unknown - MozCon
thekraken
40
2.2k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
A better future with KSS
kneath
240
18k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
Why You Should Never Use an ORM
jnunemaker
PRO
60
9.6k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
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