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
310
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
570
Other Decks in Programming
See All in Programming
Kiroの仕様駆動開発から見えてきたAIコーディングとの正しい付き合い方
clshinji
1
210
Laravel Boost 超入門
fire_arlo
3
210
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
310
請來的 AI Agent 同事們在寫程式時,怎麼用 pytest 去除各種幻想與盲點
keitheis
0
120
Introducing ReActionView: A new ActionView-compatible ERB Engine @ Rails World 2025, Amsterdam
marcoroth
0
670
アセットのコンパイルについて
ojun9
0
120
Swift Updates - Learn Languages 2025
koher
2
470
Flutter with Dart MCP: All You Need - 박제창 2025 I/O Extended Busan
itsmedreamwalker
0
150
CJK and Unicode From a PHP Committer
youkidearitai
PRO
0
110
CloudflareのChat Agent Starter Kitで簡単!AIチャットボット構築
syumai
2
480
AI Coding Agentのセキュリティリスク:PRの自己承認とメルカリの対策
s3h
0
200
Azure SRE Agentで運用は楽になるのか?
kkamegawa
0
2.1k
Featured
See All Featured
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
656
61k
The Art of Programming - Codeland 2020
erikaheidi
56
13k
The Power of CSS Pseudo Elements
geoffreycrofte
77
6k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Producing Creativity
orderedlist
PRO
347
40k
Scaling GitHub
holman
463
140k
GraphQLの誤解/rethinking-graphql
sonatard
72
11k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
840
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
Statistics for Hackers
jakevdp
799
220k
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