Android developers are quickly adopting Google's Espresso test automation framework. But like other testing tools, it has its challenges. In this talk, we'll help you overcome those challenges and uncover how Espresso can help development teams improve velocity and quality as part of a larger testing strategy.
9892124323 | Book Call Girls in Juhu and escort services 24x7
Using Espresso for Fast and Reliable Feedback
1. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Using Espresso
for Fast and Reliable Feedback
Embedding quality across the Android lifecycle
Web: perfectomobile.com Twitter: @perfectomobile
2. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
● Session is being recorded
● Email once presentation is posted
● Questions and conversation
○ Twitter: #justletmecode
○ WebEx chat panel
○ Q&A at the end of the webinar
Housekeeping
4. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
What We’ll Cover
1. Introductions to Espresso testing framework
○ The pattern and some code samples
○ Comparing Espresso and Appium
2. Improving build verification in CI
○ Testing types and schedules
○ Espresso on real devices in Jenkins
3. Pros & Cons of DIY lab setup
○ Common pitfalls and requirements for success
4. Accelerating the feedback loop
5. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Poll: Which UI testing technologies do you use?
● Espresso
● Appium
● Robotium
● UI Automator
● Other
6. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Introductions to the Espresso test framework
I
Using Espresso for Fast and Reliable Feedback
Embedding quality across the Android lifecycle
7. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Automated UI Testing for Android apps
● Creates folder for tests (androidTests)
● Adds Espresso libraries as dependencies
8. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
On the surface, a fluent UI testing pattern
onData(ObjectMatcher)
.DataOptions
.perform(ViewAction)
.check(ViewAssertion)
Find It
Act on It
Check It
onView(Matcher)
.perform(ViewAction)
.check(ViewAssertion)
9. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Espresso syntax in a nutshell
Find
onView(withId(R.id.bill_value))
onView(allOf(
withId(R.id.bill_value),
isDisplayed()
))
// see ViewMatchers.
Act
.perform(replaceText(“25.44”))
.perform(
click(),
typeText(“...”)
)
.perform(pressBackButton())
.perform(swipeUp())
// see ViewActions.
Check
.check(matches(isDisplayed()))
.check(matches(
not(isDisplayed())
))
.check(doesNotExist())
.check(matches(withText(“...”)))
// see ViewAssertions.
10. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Espresso in Android Studio
11. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
How ADB and
instrumentation
work together
12. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
How does the alternative (Appium) work?
13. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Pros/cons on both sides
Espresso/XCTest WebDriver...
Instrumented Black-box
Code+ XPath+
Ecosystem IndependentUpgrades
Execution
Object Locators
N YCross-platform
Depends+ Depends-Stability
bit.ly/oss-test-choices
14. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Espresso avoids sleep() creep
15. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Espresso avoids XPath delta breakage
Strings tell your compiler NOTHING!!!
No refactoring support
Can you write them properly...yes! Do you?
None of these things apply to compilable statements (i.e. R…).
16. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
More Espresso getting started resources:
● Intro to Espresso and Spoon
bit.ly/2kN4DAZ
● Vogella - Espresso Tutorial
bit.ly/2l0y6lY
● Watch everything from Chiu Ki Chan on YouTube
● Tweet / email me with questions! @paulsbruce me@paulsbruce.io
17. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Improving build verification in CI
2
Using Espresso for Fast and Reliable Feedback
Embedding quality across the Android lifecycle
18. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Feedback loops across the pipeline
19. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Complete feedback at the right times
20. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Local Build Commit → Build Full / Nightly
Unit / New UI Integration / Smoke Full Regression
Fake Real Real
Static Mocks SandboxAPI
Tests
Hardware
A simple recipe for fast and complete feedback
< 2min < 20min < 2hr
22. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Pros & cons of DIY lab setup
3
Using Espresso for Fast and Reliable Feedback
Embedding quality across the Android lifecycle
23. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Devices: local or cloud?
Local Build Merge → Build Full / Nightly
✓ ! ✘
! ✘ ✘
✓ ✓ ✓Cloud Lab
Emulator
Local Lab
24. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Less hunting, more coding
● How many devices per developer?
● In sync with the market?
● Spares, adapters?
● Storage/hosting/power costs?
● Monitoring?
● Security?
● High-volume automated testing
● Big data from CI
● Results retention & collaboration
25. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
26. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
27. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Complete quality across the entire lifecycle
28. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Accelerating the feedback loop
4
Using Espresso for Fast and Reliable Feedback
Embedding quality across the Android lifecycle
29. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Build verification, smoke tests
x5 per day * 4 critical
platforms
Regression &
end-to-end testing
nightly * 16 platforms +
conditions
fast & complete feedback
Parallel testing requires a reliable, scalable lab
30. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
Fast feedback means a lab that fits into your workflow
bit.ly/perfecto-slack
31. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
32. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
33. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
34. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
A complete view of build quality
35. Using Espresso for Fast and Reliable Feedback Web: perfectomobile.com Twitter: @perfectomobile
What We’ve Covered Today
1. Introductions to Espresso testing framework
○ The pattern and some code samples
○ Comparing Espresso and Appium
2. Improving build verification in CI
○ Testing types and schedules
○ Espresso on real devices in Jenkins
3. Pros & Cons of DIY lab setup
○ Common pitfalls and requirements for success
4. Accelerating the feedback loop
36. 4 Ways to Speed Up Your Mobile/Web App Daily Grind Web: perfectomobile.com Twitter: @perfectomobile
Q&A
.