TestNG with test libraries
jonathan.gibbons at oracle.com
Mon Jun 27 21:19:54 UTC 2016
On 06/27/2016 02:10 PM, David DeHaven wrote:
> We have a directory marked as TestNG tests but some helper classes outside that directory that we would like to use. Since TestNG tests don't use the @test (or can they?) is there a way to tell jtreg/testng to add the library to the classpath when building/running?
Are you using the TEST.properties mechanism to declare a directory full
of just TestNG tests?
Assuming you are following the convention to put a TEST.proiperties file
in the root dir of your TestNG hierarchy, with an entry like
TestNG.dirs = .
add another property
lib.dirs = <path>
where <path> is what you might otherwise put in a @library tag, i.e. a
path that does not begin with '/', which with be evaluated relative to
the immediately enclosing directory, or a path that does begin with '/',
which will be evaluated relative to the root directory of the test suite
(i.e. the directory containing the TEST.ROOT file).
TestNG tests can actually contain @test directives, but only for
documentary info, like @bug, @synopsis, etc.
More information about the jtreg-use