Better Android automation with Mobile Prism

  1. An abstraction layer which models the application under test
  2. Business use cases which leverage page models execute the tests.
# login.rb
find_css(“input#username”).set(“joe9”)
find_css(“input#password”).set(“999”)
find_xpath(“//button[@title=’submit’]”).click
# login_page.rb
class LoginPage < SitePrism::Page
element :username, “input#username”
element :password, “input#password”
element :submit, :xpath, “//button[@title=’submit’]”
end
# login_test.rb
LoginScreen.username.set(‘joe9’)
LoginScreen.password.set(‘999’)
LoginScreen.submit.click
Espresso out of the box. The documentation claims we can write “beautiful” tests. I suppose someone might consider a Chevy Cavalier beautiful … compared to a Plymouth Reliant. Smh.
Test execution code can focus on describing a use case.
Screen model implementations — stupid simple.
Attaching PrismElements to Screens.
Instantiating PrismElements. Pass an android R.id, or a Hamcrest matcher.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Add Lightness | Better Testing, Better Software

Add Lightness | Better Testing, Better Software

26 Followers

A software dev in test thinking against the grain. “To go faster, simplify, then add lightness.” ~Colin Chapman #cleancode #minaswan #innovate