Automate testing of C++ libraries on Android

429 views
Skip to first unread message

Irina

unread,
Jan 23, 2019, 9:34:40 AM1/23/19
to android-ndk
Hello,

We are developing c++ libraries, that works on different platforms and  also on Android. For Android we build static libraries, that can be used in Android application via JNI. 
For library testing on Desktop system we have a set of binaries that can be run from command line. And I would like to run the same tests on Android.
To do so I rebuilt the test binary as so library for Android and use it in test application. The test application has very simple interface. It provides some options to user (like select the test that can be run, or select all tests to run consistently). Then I test this application by passing all test numbers. As a result i have some sort of automation tests. But I think such problems/questions should be solved many times.

So could you please suggest any automate tools/frameworks that will allow to run existed с++ tests automatically?

Best Regards,
Irina

John Dallman

unread,
Jan 23, 2019, 10:03:37 AM1/23/19
to andro...@googlegroups.com
The easy way to do this is to build your test program as an Android command-line tool, and run that in the "adb shell" environment. This what I've been doing for a very similar problem (C rather than C++). You do need to have a conventional Android app to check that your shared library runs OK in an Android app, but you've already done that. 

I can provide guidance on doing this, but it's all in command line terms, because I don't use Android Studio at all. If that would be useful to you, I can prepare some postings. 

John


--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-ndk...@googlegroups.com.
To post to this group, send email to andro...@googlegroups.com.
Visit this group at https://groups.google.com/group/android-ndk.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-ndk/fa89ef48-d686-4a6b-a9da-3afefd139595%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Phil Burk

unread,
Jan 23, 2019, 3:03:09 PM1/23/19
to andro...@googlegroups.com

Steven Winston

unread,
Jan 24, 2019, 11:56:24 AM1/24/19
to android-ndk
There's a few options:

1.) unit tests
2.) integration tests
 use monkeyrunner comes with the sdk : https://developer.android.com/studio/test/monkeyrunner/
3.) UI tests
  now we're talking about fun!  If you can use espresso (i.e. if you're using android's native ui stop reading use that same page as monkeyrunner link).  If you're using a custom UI then use MSER of some kind will find buttons monkeyrunner will allow clicks on XY locations.  OpenCV + monkeyrunner

There's a bunch of other solutions entirely dependent upon what your needs are.

Irina

unread,
Jan 25, 2019, 10:56:24 AM1/25/19
to android-ndk
Hello John,

Thank you for the answer.  That would be very helpful if you could prepare such postings.
Reply all
Reply to author
Forward
0 new messages