appium / appium-espresso-driver

Espresso integration for Appium
Apache License 2.0
189 stars 75 forks source link

Replace NanoHTTPD by Ktor - PoC #661

Open misa opened 3 years ago

misa commented 3 years ago

Question

Would you be interested if I create a proof of concept with Ktor server? (There won't be that many code changes)

Current NanoHTTPD issues

Benefits of Ktor

https://ktor.io/docs/create-server.html#engine-main

Some very old benchmarks

https://github.com/orangy/http-benchmarks (It's hard to find other benchmarks with these two)

mykola-mokhnach commented 3 years ago

I think it’s blocking Kotlin update to version 1.4.x

As far as I remember the main blocking issue was this Kotlin version requires minimum Android SDK 24, while we still support SDK 21+

It also makes sense to validate the Ktor server's dependencies. Ideally the Espresso server must depend on a minimum amount of third-party packages to avoid possible conflicts.

Would you be interested if I create a proof of concept with Ktor server?

Of course we'd be interested.

misa commented 3 years ago

I think it’s blocking Kotlin update to version 1.4.x

As far as I remember the main blocking issue was this Kotlin version requires minimum Android SDK 24, while we still support SDK 21+

The current minimum Android SDK for espresso-server is 18. So I tried a hello world Android project and it works well with Kotlin 1.4.x on a Jelly Bean emulator (SDK 18). As far as I know, Kotlin doesn't have any minimum Android SDK requirements and it is able to compile into Java 6 by default (with an option to target higher versions explicitly). Maybe we should create a separate issue for this to discuss.

It also makes sense to validate the Ktor server's dependencies. Ideally, the Espresso server must depend on a minimum amount of third-party packages to avoid possible conflicts.

New dependency will be only ktor-server-netty

androidTestImplementation("io.ktor:ktor-server-netty:1.5.1")

with internal dependencies to slf4j, kotlin coroutines and netty. I will provide a more detailed list.

rajdeepv commented 3 years ago

If the app under test happens to use Ktor or any of its transitive dependencies, and it is obfuscated, then there will be a lot of issues during runtime to resolve dependencies. I have had this experience in the past when I used uiautomator2-driver to instrument my app under test and both of them use netty. Same happens with espresso-driver for any other dependencies. eg: #232