Unit testing on Android NDK -
how run unit tests on android native code (native c/c++, not java)? far i've found one similar question, , answer says use junit jni, don't want (adding jni calls seems unnecessarily complicated unit testing, , not unit test of native code anyway).
does cppunit (also suggested there) work on android? note want tests run natively on device, not on host development environment. this looks android port, worth looking at?
an official google test framework googletest ideal, doesn't seem work ndk.
i use googletest through ndk use $(call import-module bring in main .so , have single file in executable looks like
int main(int argc, char *argv[]) { #if run_gtest init_gtests(&argc,(char**)argv); run_all_gtests(); #endif } and build build_executable, deploy like:
find libs/ -type f -print -exec adb push {} /data/local/tmp \; and run like
adb shell ld_library_path=/data/local/tmp:/vendor/lib:/system/lib /data/local/tmp/gtest so doesn't test application life cycle tests unit tests.
if needed test ui similar make what's 'main' native function , invoke when activity loaded.
Comments
Post a Comment