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
2
460
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
1
320
Javent - Coroutines 101
androidvip
1
340
Abangkis - INTO KOTLIN A PRAGMATIC WAY
androidvip
3
450
Henry & Meyta - Behind The Scene of Tokopedia Android Homepage
androidvip
2
610
Other Decks in Programming
See All in Programming
CSC307 Lecture 12
javiergs
PRO
0
450
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
140
24時間止められないシステムを守る-医療ITにおけるランサムウェア対策の実際
koukimiura
2
180
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
150
Rubyと楽しいをつくる / Creating joy with Ruby
chobishiba
0
200
モジュラモノリスにおける境界をGoのinternalパッケージで守る
magavel
0
3.4k
Claude Codeセッション現状確認 2026福岡 / fukuoka-aicoding-00-beacon
monochromegane
3
380
米国のサイバーセキュリティタイムラインと見る Goの暗号パッケージの進化
tomtwinkle
1
380
CSC307 Lecture 11
javiergs
PRO
0
580
浮動小数の比較について
kishikawakatsumi
0
370
15年目のiOSアプリを1から作り直す技術
teakun
0
580
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
510
Featured
See All Featured
Everyday Curiosity
cassininazir
0
150
Mobile First: as difficult as doing things right
swwweet
225
10k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Into the Great Unknown - MozCon
thekraken
40
2.3k
Heart Work Chapter 1 - Part 1
lfama
PRO
5
35k
Google's AI Overviews - The New Search
badams
0
930
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
We Have a Design System, Now What?
morganepeng
55
8k
The Pragmatic Product Professional
lauravandoore
37
7.2k
The Curse of the Amulet
leimatthew05
1
9.4k
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
68
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