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
490
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
370
Abangkis - INTO KOTLIN A PRAGMATIC WAY
androidvip
3
470
Henry & Meyta - Behind The Scene of Tokopedia Android Homepage
androidvip
2
640
Other Decks in Programming
See All in Programming
React本体のコードリーディング
high_g_engineer
1
150
tsc.rip を支える技術 / Kyoto.なんか #8
susisu
0
130
FastAPI の並行処理モデルを完全に理解する
hoto17296
8
2.8k
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
240
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
370
メールのエイリアス機能を履き違えない
isshinfunada
0
250
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
1k
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
250
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
1.6k
初めての模倣学習とVLA
natsutan
0
190
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
220
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
140
Featured
See All Featured
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.1k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
580
How STYLIGHT went responsive
nonsquared
100
6.2k
Navigating Team Friction
lara
192
16k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
240
A Tale of Four Properties
chriscoyier
163
24k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
730
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
2
640
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
520
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
250
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