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
470
2
Share
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
330
Javent - Coroutines 101
androidvip
1
360
Abangkis - INTO KOTLIN A PRAGMATIC WAY
androidvip
3
460
Henry & Meyta - Behind The Scene of Tokopedia Android Homepage
androidvip
2
620
Other Decks in Programming
See All in Programming
不変条件と整合性境界—ビジネスが決める設計判断と実現パターン / Invariants and Consistency Boundaries
nrslib
9
2.5k
サークル参加から学ぶ、小さな事業の回し方
yuzneri
0
240
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
4
670
柔軟なPDFレイアウトエディタを支える型システム設計 — Discriminated UnionとConditional Typeの実践
minako__ph
4
610
AIエージェントの隔離技術の徹底比較
kawayu
0
430
TypeSpec で繋ぐ複数プロダクトの型安全
maroon8021
1
250
Sans tests, vos agents ne sont pas fiables
nabondance
0
160
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
160
Signal Forms: Beyond the Basics @ngBaguette 2026 in Paris
manfredsteyer
PRO
0
120
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
340
CLIであることを活かしたGitHub Copilot CLI活用術 / GitHub Copilot CLI Pro Tips & Tricks
nao_mk2
1
1.1k
New "Type" system on PicoRuby
pocke
1
190
Featured
See All Featured
Bash Introduction
62gerente
615
210k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
38
2.9k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.5k
Being A Developer After 40
akosma
91
590k
Side Projects
sachag
455
43k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
300
SEO Brein meetup: CTRL+C is not how to scale international SEO
lindahogenes
1
2.7k
Typedesign – Prime Four
hannesfritz
42
3k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Google's AI Overviews - The New Search
badams
0
1k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
140
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