Agenda:
After covering the basics about how to find and interact with UI elements, we will look into techniques of writing maintainable tests with selendroid.
In the end we will run our tests in parallel using the Selenium Grid.
The workshop repository can be found here:
https://github.com/DominikDary/selendroid-workshop
2. Who am I?
Dominik Dary
Engineering Manager @
Twitter: @dominikdary
Github: http://github.com/dominikdary
Disclaimer: My Opinions are my own.
Selendroid in Action
3. Agenda
• Short Introdution
• After covering the basics about how to find and interact with UI
elements,
• we will look into techniques of writing maintainable tests.
• In the end we will run our tests in parallel using the Selenium Grid.
Selendroid in Action
5. W3C WebDriver Spec
Selendroid in Action
JSON WIRE
PROTOCOLClient
Java
C#
Ruby
Python
i.e. FirefoxDriver, selendroid,
ios-driver
Server
https://dvcs.w3.org/hg/webdriver/raw-file/tip/webdriver-spec.html
Selendroid - Supported Methods
6. ONE PROTOCOL TO RULE THEM ALL
Selendroid in Action
Source:
http://en.wikipedia.org/wiki/File:Unico_Anello.png#file
7. Selendroid
Open sourced on github:
– https://github.com/selendroid
Documentation:
• https://selendroid.io
Committers:
– eBay, PayPal, Salesforce, Facebook,
Red Hat and many others
Getting help
– IRC : #selendroid on freenode
Selendroid in Action
8. Features
– The only mobile WebDriver that supports native & hybrid apps
and testing the mobile web on Android versions (API 10 to 23)
– Full compatibility with the JSON Wire Protocol.
– The app under test must not be modified
– No jailbreak / rooting of devices
– Interacts simultaneously with multiple Android devices
– Supports hot plugging of hardware devices
– Advanced Gestures are supported
Selendroid in Action
10. Native Element Selectors
• Id
Finds the element by Id.
• name
Finds the element by content description (accessibility label).
• link text
Finds the element by displayed text.
• partial link text
Finds the element by partial displayed text.
• class
Finds the element by full class name (e.g. android.widget.Button).
• tag name
Finds the element by tag name e.g. button
• xpath
Finds the element by a xpath expression.
Selendroid in Action
11. Selendroid Inspector
• View hierarchy
• View UI element properties
• UI screenshot with view
locator
• Record the click actions
• View HTML of a web view
• XPath helper
Selendroid in Action
Demo: http://youtu.be/JKZeF3eHljo
13. First Practical Demo
• Clone the project:
• Open Class:
git clone https://github.com/DominikDary/selendroid-workshop.git
FirstSelendroidTest
Selendroid in Action
14. FirstSelendroidTest
• Make sure you have defined an emulator (and started) or
connected a hardware device.
• Excuting „adb devices“ lists your device
• The test automatically starts and stops selendroid
Add a breakpoint
Selendroid in Action
15. Get Your Hands Dirty
• Write a Test
– that navigate to the User Registration Screen
– Use the Inspector to find the Element details
– Use these locators
• Id, name, xpath, link text
• Goal is to fill out the registration form and
• To validate on the following Dialog that the right input
Hints:
• Debug the test and use the Selendroid Inspector
(http://localhost:4444/inspector/ )
• Docu is located here: http://selendroid.io/native.html
• Do not over engineer, just write all the stepsSelendroid in Action
16. Selendroid Repl
• Interactive Command execution
• Results are immediately displayed
• The app can be manually used to navigate to the dialog you
want to automate.
• Interested? Read more:
selendroid-workshop/docs/selendroid-python-repl.md
Selendroid in Action
22. Use Pages and Flows
• If you have not finished the first session, checkout the branch
• Please create a Page Object class for every screen
• Please create a flow class that delegates to the different pages
• Change your test in order to use the flow and page objetcs
• Run your tests
git checkout resultFirstSession
Selendroid in Action
23. Second Result
• If you have not finished the first session, checkout the branch
git checkout resultSecondSession
Selendroid in Action
29. In Action
• After you have started the grid
– Check if everything is fine:
– Grid: http://127.0.0.1:4444/grid/console
– Selendroid Standalone: http://127.0.0.1:5555/wd/hub/status
• Open any previous test
– Deactive Code that starts selendroid
– Run your test
Selendroid in Action
37. Multi Touch Support
• Single finger example:
TouchAction ta = new TouchActionBuilder().pointerDown().
pointerMove(x, y).pointerUp().build();
driver.getMultiTouchScreen().executeAction(ta);
• Multi finger example (these will be executed in parallel):
TouchAction finger1 = new TouchActionBuilder().pointerDown().pause(100).
pointerMove(x, y).pointerUp().build();
TouchAction finger2 = new TouchActionBuilder().pointerDown().pause(100).
pointerMove(x, y).pointerUp().build(); MultiTouchAction multiAction = new
MultiTouchAction(finger1, finger2);
driver.getMultiTouchScreen().executeAction(multiAction);
Selendroid in Action
38. Touch Gestures Session
• Start Selendroid Test App
• Press „Touch Actions“ Button
• This Activity can be used to
– try Touch Gestures
– Identified gestures will be displayed
Selendroid in Action