mardi 14 juillet 2020

How can I run integration tests on a JNI Android library?

I need to run integration tests for an Android library that leverages native code via JNI. This has a few implications:

  • This is a library, and as such has no GUI whatsoever. This means that test frameworks like Espresso, Appium and the like are of no use, since there's no GUI to test against.
  • This gives me some headaches with popular cloud services like App Center and Firebase Test Lab, as they require both an UI instrumented test apk, written with one of the supported UI testing frameworks, and an app apk to run these tests against.
  • As said, the library contains C code loaded via JNI. Unfortunately, this excludes the possibility of using Robolectric, since it doesn't support JNI.

Now there are a few questions:

  • Are there any Android simulation testing frameworks that support JNI?
  • Is there a cloud service out there which allows me to simply run a pre-built Android instrumented unit tests apk, without any UI instrumented test framework and without an actual app to be tested?
  • Have I missed a much simpler solution to my problem?

The problem with cloud services is that currently I only have an instrumented unit test apk, which as such has no actual GUI testing. Furthermore, that's the sole apk I have, since there's no actual Android app to be tested.

I am not aware of any Android mocking test frameworks, like Robolectric, that support JNI, which is why I am looking into instrumented tests, on real or emulated Android devices, in the first place.

Aucun commentaire:

Enregistrer un commentaire