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 the test with iWebDriver follow these steps:
Create a new
JUnit
test. Name itAndroidDriverTest
.Copy the following code to the newly created
AndroidDriverTest
class:import org.openqa.selenium.WebDriver; import org.openqa.selenium.android...