Posted on :: Tags: , , , ,

I’m writing a C library for 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 the C and Android layers is correct.

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

Instrumentation tests are user tests that check whether the user-facing aspects of the app run correctly. Unit tests, instead, check whether data flow, calculations, etc., are working as expected. The former is slow; it needs to be run in an emulator and should mimic user behavior. Just checking whether e converted correctly to ا should not require an emulator.