The Sorry State of NDK testing in Android

Posted on Prş 08 Şubat 2018 in new • 1 min read

I'm writing a C library to use in Android, iOS and Python applications. Although the C library has its own unit tests, I wanted to write a few more to ensure that data transfer between C and Android layers are correct.

In Android, one needs to put unit test files in app/src/test/*module-name* directory. I spent a few hours yesterday to write tests that checks the conversion between visenc and unicode are correct in Android. After those hours, however, I learned that, NDK support for tests is limited and the error I receive means that I need to write instrumentation tests that uses the emulator or device instead.

Instrumentation tests are user tests that check whether the user facing aspects of the app runs correctly. Unit tests, instead check whether data flow, calculations etc. are working as expected. The former is slow, it needs to be run in the emulator and should mimic the user behaviour. For just checking whether e converted correctly to ا is not something that should be run under emulator.