appium / java-client

Java language binding for writing Appium Tests, conforms to W3C WebDriver Protocol
Apache License 2.0
1.2k stars 755 forks source link

Use in android studio #175

Open Diolor opened 9 years ago

Diolor commented 9 years ago

What I am trying to do is to use it directly as Robolectric unit tests in Android Studio. The problem comes when I create a new AndroidDriver():

new AndroidDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities);

The selenium driver uses the apache-http client which in Android is not complete so there are missing classes from the preloaded one. My next step is to use Jarjar to stitch together a new version of http client in the Android SDK jar.

Not sure if it worths the pain, but I would like to discuss if this sounds like a good idea (fake the UI tests as unit tests)?

A different option is of course to create a different project only to test the apk.

Fyi piece from my .gradle:

testApt 'com.squareup.dagger:dagger-compiler:1.2.2'
testCompile 'com.squareup.dagger:dagger:1.2.2'
testCompile ('io.appium:java-client:2.2.0'){
    exclude module: 'guava'
    exclude module: 'httpmime'
    exclude module: 'gson'
}
Jonahss commented 9 years ago

Hmm. Yeah it would be nice if users could run their tests directly from Android Studio. Didn't realize they weren't able to.