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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Android VIP
January 12, 2019
Programming
480
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Gilang - Playing Unit Test with Spek
Android VIP
January 12, 2019
More Decks by Android VIP
See All by Android VIP
Ghiyats Hanif - Android Templates
androidvip
1
330
Javent - Coroutines 101
androidvip
1
360
Abangkis - INTO KOTLIN A PRAGMATIC WAY
androidvip
3
460
Henry & Meyta - Behind The Scene of Tokopedia Android Homepage
androidvip
2
620
Other Decks in Programming
See All in Programming
IBM Bobを活用したレガシーアプリの最新化
oniak3ibm
PRO
1
190
CSC307 Lecture 17
javiergs
PRO
0
320
Java × distroless で 軽量なコンテナイメージを / Java on Distroless
contour_gara
0
540
その問い、本当に正しいですか?AI時代のエンジニアに必要な哲学と認知科学 / ai-philosophy-cognitive-science
minodriven
7
4.1k
Semantic Version 単位で戦略を柔軟に変えて、パッケージアップデートを自動化する
daitasu
0
220
AIとASP.NET Coreで雑Webアプリを作った話
mayuki
0
510
Datadog × OpenTelemetry 入門と実践のあいだ
kn_to_maxpno
1
150
LLM Plugin for Node-REDの利用方法と開発について
404background
0
170
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.4k
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
350
ローカルLLMを使ってB2Bサービスを作っていての学び
yaotti
0
160
キャリア迷子上等 ─ "ない道"は自分で作ればいい
16bitidol
3
2k
Featured
See All Featured
The browser strikes back
jonoalderson
0
1.2k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
Site-Speed That Sticks
csswizardry
13
1.2k
Fireside Chat
paigeccino
42
3.9k
Technical Leadership for Architectural Decision Making
baasie
3
400
Balancing Empowerment & Direction
lara
6
1.2k
Designing for humans not robots
tammielis
254
26k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
170
Docker and Python
trallard
47
3.9k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
610
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
200
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