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
Event Storming
hschwentner
3
1.3k
Geminiの機能を調べ尽くしてみた
naruyoshimi
0
190
izumin5210のプロポーザルのネタ探し #tskaigi_msup
izumin5210
1
510
登壇資料を作る時に意識していること #登壇資料_findy
konifar
5
2.1k
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
140
DevinとClaude Code、SREの現場で使い倒してみた件
karia
1
860
あなたはユーザーではない #PdENight
kajitack
4
290
TipKitTips
ktcryomm
0
150
Railsの気持ちを考えながらコントローラとビューを整頓する/tidying-rails-controllers-and-views-as-rails-think
moro
4
370
Claude Code の Skill で複雑な既存仕様をすっきり整理しよう
yuichirokato
1
240
株式会社 Sun terras カンパニーデック
sunterras
0
1.9k
SourceGeneratorのマーカー属性問題について
htkym
0
120
Featured
See All Featured
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
2.3k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
96
Typedesign – Prime Four
hannesfritz
42
3k
A Modern Web Designer's Workflow
chriscoyier
698
190k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
190
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
Amusing Abliteration
ianozsvald
0
120
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
620
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