appium-espresso-driver
appium-espresso-driver copied to clipboard
Replace NanoHTTPD by Ktor - PoC
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
- Latest version was released more than 4 years ago
- It doesn’t look like it will be maintained anymore
- I think it’s blocking Kotlin update to version 1.4.x
Benefits of Ktor
- Actively developed
- Official JetBrains framework
- Written in Kotlin
- Easy to setup
- Performance should be the same or better than NanoHTTPD
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)
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.
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.
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