Ask Your Question
1

Java tests for OpenCV 3.1 desktop

asked 2016-10-08 00:40:47 -0600

jcrist gravatar image

Are there any automated tests included in nightly builds for testing java wrappers? What is the process of contributing tests to OpenCV?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2016-10-08 01:01:47 -0600

berak gravatar image

updated 2016-10-08 01:13:17 -0600

there are tests , but the buildbots don't seem to run them automatically (e.g. here or here )

https://github.com/opencv/opencv/wiki...

edit flag offensive delete link more

Comments

Thank you for the prompt answer! Is there any guideline how build and run them locally?

jcrist gravatar imagejcrist ( 2016-10-08 01:09:27 -0600 )edit
1

idk. (no java here, atm.) but this and this seems to hint, that they're at least built, if BUILD_TESTS is present in cmake flags.

this is an interesting topic, imho. please keep us informed on what you find out !

berak gravatar imageberak ( 2016-10-08 01:19:48 -0600 )edit

Thank you berak, will try to dig it a beet deeper and will let you know.

jcrist gravatar imagejcrist ( 2016-10-08 04:12:35 -0600 )edit
1

answered 2016-10-08 06:23:23 -0600

jcrist gravatar image

updated 2016-10-11 01:50:51 -0600

Here is what I found but I'm not sure if this is the right way or not. The make process actually prints out the jar name of the junit tests for OpenCV java wrappers (opencv-test.jar). Here is how to run it.

  1. Install JRE for your platform. I have Mac so further examples will work for unix and the likes. MS Win I guess works in the similar fashion, just need to use proper path syntax.
  2. Navigate to /opencv/build folder and run the following command:

    java -cp ./modules/java/pure_test/.build/lib/junit-4.11.jar:./modules/java/pure_test/.build/build/jar/opencv-test.jar:./bin/opencv-310.jar -Djava.library.path="./lib" junit.textui.TestRunner org.opencv.test.opencv-package-name.test-class-name

opencv-package-name stands for the name of the corresponding opencv module, for example calib3d, core, features2d, highgui, imgproc, objdetect, photo, utils, video etc.

test-class-name can be any class from that package, which inherits from OpenCVTestCase. For example:

java -cp ./modules/java/pure_test/.build/lib/junit-4.11.jar:./modules/java/pure_test/.build/build/jar/opencv-test.jar:./bin/opencv-310.jar -Djava.library.path="./lib" junit.textui.TestRunner org.opencv.test.utils.ConvertersTest

will produce the following output:

.........................................

Time: 0.295

OK (41 tests)

UPDATE: as expected things are much more simple than we think of them initially )) OpenCV good team did great job already - all tests including java tests can be run from the build directory by this command:

python ../modules/ts/misc/run.py

more information is here. The only confusing part of documentation - seems like this command actually runs all tests so it can be used not only for performance control.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-10-08 00:40:47 -0600

Seen: 858 times

Last updated: Oct 11 '16