sometimes i need to build opencv unit tests outside the library building process,
you don't want to wait for the libs to rebuild or to wait for 50 other tests to finish before yours

you need to add the include path to the test headers (they're not installed !)

-I opencv_src/modules/ts/include
and the path to cvconfig.h, that's in your build folder:
-I opencv_src/build
and link to opencv_ts .
now, to run this without downloading the whole opencv_extra repo (and setting it up)
its also possible to use a local data folder structure, like:
C:\P\OPENCV_CONTRIB\MODULES\FACE\TEST
└───cv
    └───face
and configure an environment variable to point at it, (keeping the same directory structure as on the buildbots):
set OPENCV_TEST_DATA_PATH=C:\P\OPENCV_CONTRIB\MODULES\FACE\TEST