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
何故テストが書けないのか #ios_test_night /why_we_cannot_wri...
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
fromkk
December 05, 2017
Programming
3.2k
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
何故テストが書けないのか #ios_test_night /why_we_cannot_write_test
2017/12/05(火)DeNAさんで開催されたiOS Test Night #6 - 1周年 - で発表した内容です。
fromkk
December 05, 2017
More Decks by fromkk
See All by fromkk
note社の全員野球で品質向上活動について / note_qa_challenge #iOS_test_teatime
fromkk
3
2.1k
1年分のデータが見たいと言われてやったこと/yearly_data_with_note
fromkk
0
1.1k
note iOSチームの自動化 ver.2021/automation_with_iOS_team_on_note_ver2021
fromkk
0
2.1k
Bitrise体験会説明資料/bitrise_explore
fromkk
1
1.2k
noteのiOSアプリで実装したアクセシビリティの全て #iosdc #a /a11y_with_iOS_App_on_note
fromkk
2
5.3k
dSYMのアップロードで SPMを活用する/use_spm_with_upload_dsyms
fromkk
1
3.3k
Bitriseのリモートアクセス機能 #bitrise_meetup/remote_access_of_bitrise
fromkk
1
700
note社でのMagic Pod活用事例 #af_iosdc/magicpod_with_note
fromkk
2
12k
iOSには無いmacOS独自機能をCatalystで実装する #iosdc #d/make_macos_apps_with_catalyst
fromkk
9
2.3k
Other Decks in Programming
See All in Programming
Security issues being discussed on Web Platforms
petamoriken
0
1.1k
難しいけど、読めた。- OSSの入口に立った話。
sts11142
0
110
TiDB Cloudのカスタムコントローラーによるオートスケール対応
takaidohigasi
0
130
MVNOの申込からeSIM開通までをiOSアプリでつなぐ- 本人確認・MNP・通信事業者基盤をまたぐ実装
satotakeshi
0
460
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
8.1k
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.4k
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
1
6.1k
JPUG勉強会 OSSデータベースの内部構造を理解しよう(第2回)
oga5
0
270
手動確認はもう限界 〜XCUITestでCustom URL Schemeの遷移を起動種別ごとに自動テストする〜 / Testing Custom URL Schemes with XCUITest
otouto
0
320
AHC070解法紹介
eijirou
0
130
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
260
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
4
740
Featured
See All Featured
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
65k
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
530
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
900
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The Cost Of JavaScript in 2023
addyosmani
55
10k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Marketing to machines
jonoalderson
1
5.8k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Designing Experiences People Love
moore
143
24k
Done Done
chrislema
186
17k
4 Signs Your Business is Dying
shpigford
187
23k
Transcript
Կނςετ͕ॻ͚ͳ͍ͷ͔ iOS Test Night #6 1
Profile Kazuya Ueoka Timers inc.ͷiOSΤϯδχΞ Twitter: @fromkk Github: fromkk Qiita:
fromkk Sarahah: fromkk 2
3
4
ʊਓਓਓਓਓʊ ʼɹςετ0ɹʻ ʉY^Y^Y^Yʉ 5
ςετΛͪΌΜͱ ॻ͔ͳ͍ͱͳʔͱࢥ͍ͬͯ·ͨ͠ 6
͊͞ɺطଘίʔυʹ ςετΛॻ͜͏ 7
ͱࢥͬͯ طଘίʔυΛோΊ·͢ 8
! 9
μϝͩɺςετॻ͚ͳ͍ 10
Կނͳͷ͔ 11
ςετ͕ॻ͚ͳ͍งғؾ • ViewControllerͰ࣮σʔλʹΞΫηε • ຊ൪αʔόʔ/ϩʔΧϧDB/UserDefaults • ίʔυͰγϯάϧτϯݺͼग़͠ • ҰͭͷΫϥε͕Λ͍࣋ͪ͗ͯ͢Δ(અࢠ) •
ΠϕϯτϋϯυϦϯά/delegate/Notification/Observation ͷॲཧΛશ͚ͯෛ͍ͬͯΔ 12
ςετ 0ݸ ͳϓϩδΣΫτʹ ϢχοτςετΛՃͯ͠Έͨ 13
ରͷը໘ 14
ࠓճͷςετͷ؍ • ը໘ىಈ࣌ʹMarkdownϑΝΠϧΛಡΈࠐΜͰtextViewͷॳ ظʹઃఆ͞Ε͍ͯΔࣄ • อଘ͍ͨ͠λΠϛϯάͰอଘ͞ΕΔࣄ 15
ͬͨࣄ ͦͷ1 16
ςετதRealmΛInMemoryػೳΛ༗ޮʹ class DB { static var isTesting: Bool = false
private static var userConfiguration: Realm.Configuration { return Realm.Configuration() } private static var inMemoryConfiguration: Realm.Configuration { return Realm.Configuration(inMemoryIdentifier: "InMemory") } static var realm: Realm { let configuration: Realm.Configuration if isTesting { configuration = inMemoryConfiguration } else { configuration = userConfiguration } return try! Realm(configuration: configuration) } } 17
ͬͨࣄ ͦͷ2 18
ʊਓਓਓਓਓਓਓਓਓਓਓʊ ʼɹઃܭͷݟ͠ʂʂʂɹʻ ʉY^Y^Y^Y^Y^Y^Y^Y^Y^Yʉ 19
͜Ε·Ͱ 20
ݟ͠ޙ 21
ςετ @testable import Type class RegisterViewControllerTests: XCTestCase { class MockRegistrable:
MarkdownRegistrable { let defaultValue = "Hello world" func open(_ completed: @escaping (String) -> ()) { completed(defaultValue) } var isSaved: Bool = false func save(with markdown: String) { isSaved = true } } private func makeViewController() -> RegisterViewController { let registrable = MockRegistrable() let viewController = RegisterViewController() viewController.registrable = registrable return viewController } func testOpen() { let viewController = makeViewController() viewController.open() XCTAssetEqual(registrable.textView.text, "Hello world") } func testSave() { let viewController = makeViewController() viewController.save(with: "hoge huga") XCTAssetTrue(registrable.isSaved) } } 22
ςετ͕ॻ͚ͨ 23
ςετΛॻ͍ͯݟͯ • ςετ͕ॻ͚Δ͔Ͳ͏͔ઃܭ࣍ୈͱ͍͏ࣄ͕ʹ͠Έͯ ͔ͬͨ • ϓϩύςΟ͕ࠩ͠ସ͕͑Մೳɾ֎͔Β͕ͤΔ༷ʹͳͬ ͍ͯΔࣄ͕ॏཁ • (࣮ίʔυͰ͏গ͠ςετΛॻ͍͕ͨ)؍ͷ࿙Εʹؾ ͘ࣄ͕ग़དྷͨ
24
·ͱΊ • ςετෆՄೳΛςετՄೳʹม͑Δࣄ͕ग़དྷ·ͨ͠ • ςετ͕ग़དྷͳ͍࣌ઃܭΛݟ͢ • ઃܭΛݟͤςετ͕ग़དྷΔ • େ෯ʹઃܭΛม͑ͯςετ͕͋ΔͷͰ҆৺ 25
PR 26
27
28
29
ΤϯδχΞืूத 30
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠ 31