Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Screenshot your Entire App with Screengrab and Firebase
Edward Dale
November 03, 2016
Technology
0
320
Screenshot your Entire App with Screengrab and Firebase
Presentation from the GDG Munich Android meetup
Edward Dale
November 03, 2016
Tweet
Share
More Decks by Edward Dale
See All by Edward Dale
Write your own ProGuard
scompt
1
130
ProGuard
scompt
1
260
Screenshot your Entire App
scompt
1
1.7k
Reactive In-App Billing on Android
scompt
2
240
Fitness Motion Recognition with Android Wear
scompt
1
320
Android Apps with Mortar and Flow
scompt
7
1.5k
Functional Reactive Programming in the Mobile World
scompt
2
280
Other Decks in Technology
See All in Technology
キャッチアップ Android 13 / Catch up Android 13
yanzm
2
1.1k
20220510_簡単にできるコスト異常検出(Cost Anomaly Detection) /jaws-ug-asa-cost-anomaly-detection-20220510
emiki
2
320
CTOのためのQAのつくりかた #scrumniigata / SigSQA How to create QA for CTOs and VPoEs
caori_t
0
110
Graph API について
miyakemito
0
230
Kubernetesの上に作る、統一されたマイクロサービス運用体験
tkuchiki
1
830
THETA Xの登場はジオ業界を変えるか?
furuhashilab
0
160
Poolにおける足を止めないシステム基盤構築
winebarrel
3
730
GitHub 엔터프라이즈 어카운트 소개 및 엔터프라이즈 서버 구축 경험
posquit0
1
140
Learning from AWS Customer Security Incidents [2022]
ramimac
0
630
Nutanix_Meetup_20220511
keigotomomatsu
0
150
1年間のポストモーテム運用とそこから生まれたツール sre-advisor / SRE NEXT 2022
fujiwara3
6
3.1k
Oracle Database Technology Night #55 Oracle Autonomous Database 再入門
oracle4engineer
PRO
1
120
Featured
See All Featured
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
119
28k
Bash Introduction
62gerente
596
210k
Agile that works and the tools we love
rasmusluckow
319
19k
The MySQL Ecosystem @ GitHub 2015
samlambert
238
11k
Stop Working from a Prison Cell
hatefulcrawdad
261
17k
A designer walks into a library…
pauljervisheath
196
16k
Statistics for Hackers
jakevdp
781
210k
Side Projects
sachag
449
37k
The Art of Programming - Codeland 2020
erikaheidi
31
5.8k
How To Stay Up To Date on Web Technology
chriscoyier
780
250k
Support Driven Design
roundedbygravity
86
8.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
19
1.1k
Transcript
Screenshot your Entire App Edward Dale Freeletics © Edward Dale,
2016 1
Screenshot your Entire App with Screengrab and Firebase Edward Dale
Freeletics © Edward Dale, 2016 2
Find the bug(s) © Edward Dale, 2016 3
© Edward Dale, 2016 4
© Edward Dale, 2016 5
Some things are best verified visually ! Screenshot © Edward
Dale, 2016 6
Screenshots are useful for • Acceptance testing • Edge case
• Localization • Multiple devices • Regression testing © Edward Dale, 2016 7
Screenshot testing tools • Espresso tests • Dependency injection •
Dependency mocking • Screengrab • Firebase Cloud Test Lab for Android © Edward Dale, 2016 8
Espresso test setup @MediumTest public class BuyCoachScreenGrab { @Inject DummyUserManager
mUserManager; @Rule public ActivityTestRule<BuyCoachActivity> mActivityRule = new ActivityTestRule<>(BuyCoachActivity.class, false, false); © Edward Dale, 2016 9
Automated localized screenshots of your Android app on every device
Screengrab ▶ Fastlane ▶ Fabric ▶ Twitter Combination of command-line tool and classes used in tests © Edward Dale, 2016 10
Screengrab test @Test public void testTestimonialMale() { when(mUserManager.getUser().getGender()).thenReturn(Gender.MALE); mActivityRule.launchActivity(new Intent());
onView(withId(R.id.feature_pager_videos)).perform(scrollTo()); Screengrab.screenshot("buy_coach_male_testimonial"); } © Edward Dale, 2016 11
Screengrab test @Test public void testTestimonialMale() { when(mUserManager.getUser().getGender()).thenReturn(Gender.MALE); mActivityRule.launchActivity(new Intent());
onView(withId(R.id.feature_pager_videos)).perform(scrollTo()); Screengrab.screenshot("buy_coach_male_testimonial"); } @Test public void testTestimonialFemale() { when(mUserManager.getUser().getGender()).thenReturn(Gender.FEMALE); mActivityRule.launchActivity(new Intent()); onView(withId(R.id.feature_pager_videos)).perform(scrollTo()); Screengrab.screenshot("buy_coach_female_testimonial"); } © Edward Dale, 2016 12
Screengrab configuration app_package_name 'com.freeletics.debug' app_apk_path 'Freeletics-debug.apk' tests_apk_path 'Freeletics-debug-androidTest.apk' locales ['en-US',
'fr-FR', 'it-IT', 'de-DE', 'pt-PT', 'es-ES', 'tr-TR', 'ja-JA'] use_tests_in_classes ['com.freeletics.coach.view.BuyCoachScreenGrab'] © Edward Dale, 2016 13
Running Screengrab $ ./gradlew clean assembleDebug assembleDebugTest $ screengrab ©
Edward Dale, 2016 14
Firebase Cloud Test Lab for Android Test your app on
devices hosted in a Google datacenter. Combination of command-line tool and classes used in tests Also supports virtual devices © Edward Dale, 2016 15
Firebase Cloud Test Lab for Android Test your app on
devices hosted in a Google datacenter. Combination of command-line tool and classes used in tests Also supports virtual devices $€£¥ © Edward Dale, 2016 16
Firebase test @Test public void testTestimonialMale() { when(mUserManager.getUser().getGender()).thenReturn(Gender.MALE); Activity activity
= mActivityRule.launchActivity(new Intent()); onView(withId(R.id.feature_pager_videos)).perform(scrollTo()); ScreenShotter.takeScreenshot("buy_coach_male_testimonial", activity); } © Edward Dale, 2016 17
Screengrab Screengrab.screenshot("buy_coach_male_testimonial"); Firebase ScreenShotter.takeScreenshot("buy_coach_male_testimonial", activity); © Edward Dale, 2016 18
Running Firebase gcloud beta test android run --type instrumentation --app
Freeletics-debug.apk --test Freeletics-debug-androidTest.apk --device-ids Nexus6 --os-version-ids 21 --locales en-US,fr-FR,it-IT,de-DE,pt-PT,es-ES,tr-TR,ja-JA --orientations portrait --test-targets "class com.freeletics.coach.view.BuyCoachScreenGrab" Also possible to stick this in a YML configuration file. © Edward Dale, 2016 19
Screengrab vs Firebase Fight! © Edward Dale, 2016 20
Screengrab • ✅ Free • ✅ No waiting for a
free device • ❌ Limited by your devices © Edward Dale, 2016 21
Firebase • ✅ Easy to setup a test matrix •
✅ Fits well with a CI system • ❌ Have to wait your turn • ❌ Costs money • $5/hour for real device • $1/hour for virtual device © Edward Dale, 2016 22
My suggestion Use both © Edward Dale, 2016 23
Cross-platform test @Test public void testTestimonialMale() { when(mUserManager.getUser().getGender()).thenReturn(Gender.MALE); Activity activity
= mActivityRule.launchActivity(new Intent()); onView(withId(R.id.feature_pager_videos)).perform(scrollTo()); ScreenShotter.takeScreenshot("buy_coach_male_testimonial", activity); Screengrab.screenshot("buy_coach_male_testimonial"); } Screengrab for daily development Firebase for CI regression testing © Edward Dale, 2016 24
Thanks! Edward Dale (@scompt) Freeletics (We're hiring) © Edward Dale,
2016 25