Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Gilang - Playing Unit Test with Spek
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
340
Javent - Coroutines 101
androidvip
1
380
Abangkis - INTO KOTLIN A PRAGMATIC WAY
androidvip
3
480
Henry & Meyta - Behind The Scene of Tokopedia Android Homepage
androidvip
2
650
Other Decks in Programming
See All in Programming
AIに “答え“を書かせるのを やめてみた
___akari11
0
110
仕様駆動開発による爆速プロダクト開発 / Bakusoku Spec Driven Development
kobakei
0
200
AI時代のコードレビューは人に向けるな、仕組みに向けろ
texmeijin
5
3.5k
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
450
半永久的に提供し続けられるプライベートクラウドを目指して ― 利用者の認知負荷を抑えるAPI抽象化とハードウェア世代交代の基盤設計
tomokon
0
450
大喜利で理解するLLM as a Judge / Understanding LLM-as-a-Judge through Ogiri
rockname
0
190
mrbgem 三角測量 開発
ogom
0
210
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
310
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
390
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
更なる可用性を求めて、5年間運用したKotlinのアプリケーションをGoでリプレイスする話
ken_tunc
0
450
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
470
Featured
See All Featured
Design in an AI World
tapps
1
350
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Abbi's Birthday
coloredviolet
4
10k
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
570
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Deep Space Network (abreviated)
tonyrice
0
360
Bioeconomy Workshop: Dr. Julius Ecuru, Opportunities for a Bioeconomy in West Africa
akademiya2063
PRO
1
390
[RailsConf 2023] Rails as a piece of cake
palkan
59
7.1k
How to Ace a Technical Interview
jacobian
280
24k
The Curse of the Amulet
leimatthew05
3
15k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
600
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.6k
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