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
みんな使おう! AWS Device Farm
Search
Sato Takeshi
February 23, 2017
Technology
1
740
みんな使おう! AWS Device Farm
GEEK GARAGE iOS vol1
https://geekgarage.connpass.com/event/50929/
の資料です。
Sato Takeshi
February 23, 2017
Tweet
Share
More Decks by Sato Takeshi
See All by Sato Takeshi
Swift愛好会 の 思い出
satotakeshi
0
62
Xcode 15, Swift 5.9で変わる開発体験
satotakeshi
3
2.8k
Meet passkeys
satotakeshi
2
320
What's new in Vision
satotakeshi
0
1.3k
Swift Concurrency入門
satotakeshi
10
4.8k
複数端末のつらさを乗り越えてiOS UITestを実行
satotakeshi
1
360
Xcodegenを個人アプリに導入
satotakeshi
3
700
SwiftUIで作る開閉式メニュー
satotakeshi
2
2.9k
swift-snapshot-testingでVisual Testingを効率化
satotakeshi
0
1.1k
Other Decks in Technology
See All in Technology
安心してください、日本語使えますよ―Ubuntu日本語Remix提供休止に寄せて― 2024-11-17
nobutomurata
1
1k
アプリエンジニアのためのGraphQL入門.pdf
spycwolf
0
100
生成AIが変えるデータ分析の全体像
ishikawa_satoru
0
170
強いチームと開発生産性
onk
PRO
35
12k
Adopting Jetpack Compose in Your Existing Project - GDG DevFest Bangkok 2024
akexorcist
0
120
TypeScriptの次なる大進化なるか!? 条件型を返り値とする関数の型推論
uhyo
2
1.7k
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
The Role of Developer Relations in AI Product Success.
giftojabu1
1
150
Lexical Analysis
shigashiyama
1
150
マルチモーダル / AI Agent / LLMOps 3つの技術トレンドで理解するLLMの今後の展望
hirosatogamo
37
13k
Storybook との上手な向き合い方を考える
re_taro
4
680
DynamoDB でスロットリングが発生したとき_大盛りver/when_throttling_occurs_in_dynamodb_long
emiki
1
450
Featured
See All Featured
We Have a Design System, Now What?
morganepeng
50
7.2k
The Art of Programming - Codeland 2020
erikaheidi
52
13k
Statistics for Hackers
jakevdp
796
220k
Done Done
chrislema
181
16k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Building Your Own Lightsaber
phodgson
103
6.1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
28
9.1k
How to train your dragon (web standard)
notwaldorf
88
5.7k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
How STYLIGHT went responsive
nonsquared
95
5.2k
Transcript
ΈΜͳ͓͏ʂ AWS Device Farm 20172݄23 ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23
1
ࣗݾհ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 2
ࠤ౻߶࢜(@hatakenokakashi) SIاۀͷอकӡ༻͔ΒɺελʔτΞοϓͷCTOΛܦͯɺ MAMORIOגࣜձࣾʹ2݄͔ΒiOSΤϯδχΞΛ͍ͯ͠·͢ɻ RailsͱJavaScript(ES6)ͱGolangͱ༑ୡʹͳΔͷ͕ࠓͷඪɻ ίʔώʔͱϛϯτςΟ͕͖ɻ ϒϩάɿhttp://blog.personal-factory.com/ ΈΜͳ͓͏ʂ AWS Device Farm
2017/2/23 3
ςετͭΒ͍ͬ͢ΑͶ! ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 4
։ൃͲΜͲΜਐΉ ͦͷͨͼʹશΛςετ͠ͳ͖Ό͍ ͚ͳ͍ɻ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 5
ͦ͜ʹཱ͔ͪΔ • ༻ҙ͕େม • ૿େ͢Δςετ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23
6
Ͳ͏͠Α͏(´ɾТɾʆ) ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 7
ͦ͜ͰԞ͞Μʂ Device Farmͷग़൪Ͱ͢ʂ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 8
Device FarmͬͯԿʁ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 9
Device Farm • AWSͷεϚϑΥ&WebΞϓϦ͚ςετࣗಈԽαʔϏε • iOSɺAndroid֤֤OSόʔδϣϯΛऔΓἧ͑Δ • ࠷ॳͷ߹ܭ250·Ͱແྉɻޙ0.17 USD/ ΈΜͳ͓͏ʂ
AWS Device Farm 2017/2/23 10
๛ͳछྨ&OSόʔδϣϯ • iPhone4s-iPhone7PlusͷiOS7.1͔ΒiOS10·Ͱ • iPad2/iPad miniୈҰੈ/iPad Pro • Android΄΅ओཁͳΛͦΖ͍͑ͯΔʢͨͩ͠άϩʔόϧ൛) •
AndroidຊΩϟϦΞ͕ΧελϚΠζ͍ͯ͠ΔͷͰ ҙʂ https://aws.amazon.com/jp/device-farm/device-list/ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 11
ͲΜͳςετ͕Ͱ͖Δ͔ʁ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 12
Fuzz • DeviceFarmʹ༧Ί༻ҙ͞Ε͍ͯΔϑϨʔϜϫʔΫ • σλϥϝʹUIΞΫγϣϯΛ࣮ߦ͢Δɻ • ϞϯΩʔςετͱͯ͠ΞϓϦ͕མͪͳ͍͔Ͳ͏͔νΣοΫͰ ͖Δɻ ΈΜͳ͓͏ʂ AWS
Device Farm 2017/2/23 13
Appium • Java JUnitɺJava TestNGɺPython • iOS/AndroidʹରԠ͢ΔςετϑϨʔϜϫʔΫɻ • Appiumࣗମ༷ʑͳݴޠͰಈ͚͘ͲDeviceFarmͰରԠ͠ ͍ͯΔͷJavaͱPythonͷΈɻ
ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 14
Calabash • Xamarin͕ࣾϝϯςϯφεΛ͍ͯ͠ΔΦʔϓϯιʔεςετϑ ϨʔϜϫʔΫ • iOS/AndroidʹରԠ • RubyͰಈ͘ ΈΜͳ͓͏ʂ AWS
Device Farm 2017/2/23 15
UI Automation(Xcode7·Ͱ) • Xcodeʹ͍ͭͯ͘ΔInstrumentsʹଐ͢ΔςετϑϨʔϜϫ ʔΫ • iOSʹରԠ • JavaScriptͰiOSΞϓϦͷUIΛૢ࡞Ͱ͖Δɻ •
Xcode8͔ΒInstruments͔Βআ͞Ε༻Ͱ͖ͳ͍ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 16
XCTest (XCUI ͓Αͼ KIF ΛؚΉ) • Xcodeʹଐ͢ΔiOSΞϓϦͷςετϑϨʔϜϫʔΫ • Ϣχοτςετ͕XCTest •
UIςετΛ͢ΔʹXCUI ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 17
AndroidͷςετϑϨʔϜϫʔΫ • Instrumentation • UI Automator • JUnit • Espresso
• Robotium ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 18
ࢼͯ͠ΈΔ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 19
XCUIͰͬͯΈΔ 1. ΞϓϦΛϏϧυ͢Δ 2. XCUIΛϏϧυ͢Δ 3. Payload.ipaϑΝΠϧΛͭ͘Δ 4. Device FarmʹΞϓϦͱςετΛొ࣮͠ߦ
5. ςετ݁ՌΛΈΔ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 20
ΞϓϦΛϏϧυ͢Δ XcodeͷProduct -> ArchiveͰΞʔΧΠ ϒ OrganaizerϖʔδͰExport ΈΜͳ͓͏ʂ AWS Device Farm
2017/2/23 21
Save for Development DeploymentΛ બ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23
22
Device SupportΛExport one app for all compatible devicesʹબ ΈΜͳ͓͏ʂ AWS
Device Farm 2017/2/23 23
XCUIͰςετίʔυΛॻ͘ import XCTest class MAMORIOUITests: XCTestCase { override func setUp()
{ super.setUp() continueAfterFailure = false XCUIApplication().launch() } func test1Tutorial() {} } ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 24
XCUIΛϏϧυ͢Δ Product > Build For > Testing ΈΜͳ͓͏ʂ AWS Device
Farm 2017/2/23 25
[UITestName]-Runner.appΛऔಘ ϏϧυύεΛݟΔ /Users/<UserName>/Library/ Developer/Xcode/DerivedData/ <App Name>-xxxxxxxxxxxxxxxxx/ Build/Products/Debug-iphoneos/ ΈΜͳ͓͏ʂ AWS Device
Farm 2017/2/23 26
ιʔεҰཡͷ Products >ɹ[APPNAME].app ΛӈΫϦοΫͰFinderΛ։͍ͯྑ͍ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 27
Payload.ipaϑΝΠϧΛͭ͘Δ 1. PayloadσΟϨΫτϦΛ࡞Γ[UITestName]-Runner.appΛೖΕ Δɻ 2. ͦͷޙʹzipͰPayloadσΟϨΫτϦΛѹॖ͢Δɻ 3. Payload.zipΛPayload.ipaʹϦωʔϜ͢Δɻ ΈΜͳ͓͏ʂ AWS
Device Farm 2017/2/23 28
mkdir Payload mv [UITestName]-Runner.app Payload zip Payload.zip Payload mv Payload.zip
Payload.ipa ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 29
Device FarmʹΞϓϦͱςε τΛొ࣮͠ߦ Create a new project ΛΫϦοΫ Create a
new run ΛΫϦοΫ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 30
ΞϓϦͷipaϑΝΠϧ ΛΞοϓϩʔυ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 31
XCTest UIΛબΜͰ Payload.ipaΛΞοϓ ϩʔυ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 32
DeviceΛબͼ·͢ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 33
DeviceͷৄࡉΛ͠·͢ ϩέʔγϣϯΛJapanʹ͢Ε͍͍ͱࢥ ͏ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 34
DeviceͷλΠϜΞ τઃఆΛ͢Δ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 35
ςετ݁ՌΛΈΔ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 36
DEMO DeviceFarmͷίϯιʔϧ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 37
XCUIͷઆ໌ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 38
XCUIͷઆ໌ • XCUIApplicationͰΞϓϦऔಘͯ͠ • XCUIElementQueryͰUI෦Λݕࡧ ͯ͠ • XCUIElementͰλοϓͳͲUIૢ࡞Λ ͢Δ let
app = XCUIApplication() app.buttons["startButton"].tap() ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 39
XCUIElementQueryͰݕࡧ Ͱ͖ΔΑ͏ʹ accessibilityIdentifierΛઃఆ͠·͠ΐ ͏ɻ Storyboard͜Ε ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23
40
ίʔυͪ͜Β let title : UILabel = UILabel.init(frame:CGRect(x:0 ,y:0, width:100, height:90))
title.isAccessibilityElement = true title.accessibilityIdentifier = "logoutLabel" ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 41
XCUIͰTips 1. γεςϜΞϥʔτͷλοϓํ๏(ϓογϡ௨ڐՄɺϩέʔγ ϣϯڐՄ) 2. webαΠτͷදࣔ(openͰ։͘ͱΕͳ͍ɻwebViewͰදࣔ ͠Α͏) 3. XCUIͷςετ࣮ߦॱ(ϝιου໊ͷιʔτ) 4.
Device Farmͷ࣮ߦॱ(ϝιου࣮ͷԼ͔Β࣮ߦ͞ΕΔ) ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 42
γεςϜΞϥʔτͷλοϓํ ๏(ϓογϡ௨ڐՄɺϩέʔ γϣϯڐՄ) ͜ΕͩΊ let app = XCUIApplication() let notifiAlert
= app.alerts["“MAMORIO”௨Λૹ৴͠·͢ɻΑΖ͍͠Ͱ͔͢?"] let comfirmButton = notifiAlert.buttons["ڐՄ"] if comfirmButton.exists { comfirmButton.tap() } ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 43
addUIInterruptionMonitor ϝιουΛ࣮ߦ͢Δඞཁ͕͋Δ //͜Ε͕ඞཁ addUIInterruptionMonitor(withDescription: "notificationAlert", handler: { alert in if
alert.buttons["ڐՄ"].exists { alert.buttons["ڐՄ"].tap() return true } if alert.buttons["Allow"].exists { alert.buttons["Allow"].tap() return true } return false }) app.tap() ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 44
webαΠτͷදࣔ UIApplicationͷopenͰSafariΞϓϦΛ։͘ͱΕͳ͍ɻ func linkURL(string :String) { if let url =
URL(string:string) { if #available(iOS 10.0, *) { UIApplication.shared.open(url) } else { UIApplication.shared.openURL(url) } } } ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 45
WebViewͰදࣔ͠Α͏ɻ if let url = URL(string:string) { if let rootViewController
= self.keyWindow?.rootViewController { let safariViewController = SFSafariViewController.init(url: url) rootViewController.present(safariViewController, animated: true, completion: nil) } } ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 46
XCUIͷςετ࣮ߦॱ XCTestCaseͷςετͷ࣮ߦॱϝιου໊ͷঢॱɻ ॳճىಈϢʔβʔొͳͲ࣮ߦॱ͕େࣄʹͳΔ߹ʹؾΛͭ ͚Δɻ func test4PasswordReset(){} func test3RegisterUser(){} func test2TemporaryLogin(){}
func test1Tutorial() {} ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 47
Device Farmͷ࣮ߦॱ ϝιου࣮ॱͷԼ͔Β࣮ߦ͞ΕΔɻ ϝιου໊ͷঢॱͰͳ͍ͷͰҙʂ func test4PasswordReset(){} func test3RegisterUser(){} func test2TemporaryLogin(){}
func test1Tutorial() {} ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 48
Α͍ςετϥΠϑΛա͝ ͠·͠ΐ͏✨ ΈΜͳ͓͏ʂ AWS Device Farm 2017/2/23 49