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
320
Javent - Coroutines 101
androidvip
0
330
Abangkis - INTO KOTLIN A PRAGMATIC WAY
androidvip
2
440
Henry & Meyta - Behind The Scene of Tokopedia Android Homepage
androidvip
1
600
Other Decks in Programming
See All in Programming
クラウドに依存しないS3を使った開発術
simesaba80
0
220
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
210
AIエージェントの設計で注意するべきポイント6選
har1101
6
3k
Denoのセキュリティに関する仕組みの紹介 (toranoana.deno #23)
uki00a
0
220
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
210
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
670
公共交通オープンデータ × モバイルUX 複雑な運行情報を 『直感』に変換する技術
tinykitten
PRO
0
180
フロントエンド開発の勘所 -複数事業を経験して見えた判断軸の違い-
heimusu
6
2.1k
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
2.1k
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
440
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
520
Context is King? 〜Verifiability時代とコンテキスト設計 / Beyond "Context is King"
rkaga
10
1.5k
Featured
See All Featured
The Language of Interfaces
destraynor
162
26k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
0
140
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
150
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
140
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
120
Designing for Timeless Needs
cassininazir
0
110
Claude Code のすすめ
schroneko
67
210k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
690
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
110
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
2.8k
Rails Girls Zürich Keynote
gr2m
95
14k
Code Review Best Practice
trishagee
74
19k
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