How to unit test JNI Methods

570 views
Skip to first unread message

fahima MOKHTARI

unread,
Jul 30, 2021, 4:17:34 PM7/30/21
to rocksdb
Hi,

Well, I've been trying to expose a certain c++ method to the Java API Using JNI, and I'm lost when it comes to unit testing the jni code to make sure that the arguments are passed correctly from JNI method to the native method. I've looked in the source code well but didn't find anything that shows how the unit testing is done in such things.

I'll be very happy if you clarify things for me.

Best regards,

Fahima Mokhtari

Adam Retter

unread,
Aug 2, 2021, 7:00:58 AM8/2/21
to fahima MOKHTARI, rocksdb
Hi Fahima,

The Unit tests tend to be end-to-end tests for the Java/JNI code. Take
a look in java/src/test/java for examples.

If you have specific C++ functions that standalone that you want to
test, you can use the GoogleTest framework - take a look at some of
the files named *_test.cc.

Kind regards. Adam.
> --
> You received this message because you are subscribed to the Google Groups "rocksdb" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rocksdb+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rocksdb/846209de-5f8f-49c6-8f3c-52a89bf63b50n%40googlegroups.com.



--
Adam Retter

skype: adam.retter
tweet: adamretter
http://www.adamretter.org.uk
Reply all
Reply to author
Forward
0 new messages