Running tests using AndroidDriver

Once we have the Android server APK installed and configured on the Android emulator or device, we can create and run the tests using the AndroidDriver class.

In this recipe, we will test a simple mobile BMI calculator web application developed using jQuery Mobile on the iOS platform.

Getting ready

Before we start running the test with AndroidDriver, set up the Android emulator or device with the following steps:

  • Set up the Android emulator or a real device with the Android server APK
  • Set up the port-forwarding by using the following command:
    adb -s <serial_id> forward tcp:8080 tcp:8080
    
  • Set up a new Java project
  • Add the WebDriver JARS to the project's build path
  • Add the JUnit library to the project

How to do it...

To execute ...

Get Selenium Testing Tools Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.