some questions for TestNG support in Jtreg

Jonathan Gibbons jonathan.gibbons at oracle.com
Fri Oct 18 16:46:15 PDT 2013


Patrick,

Sorry, you can't do what you want.  You'll have to move your tests 
around a bit.

If you nominate the directory containing a1 and a2 to be a TestNG 
directory, then *all* the Java files under that directory will be 
treated as TestNG tests within the same package hierarchy.  You can't 
mix and match  having some files (like those in a1 and a2) exsiting 
within a package name space and other files (like those in a3/b3) in the 
unnamed package yet existing within an enclosing package name space.

This is no different from having any files existing in a package 
hierachy -- generally, no other tools would encourage this sort of 
organization, and jtreg is no exception.

I suggest you either move a1, a2 down a level, as in

==========
testng/a1/b1/Test1.java
testng/a2/b2/Test2.java
a3/b3/Test3.java
==========

or somewhat equivalently, move a3 up a directory level.


-- Jon



On 08/21/2013 03:47 AM, patrick zhang wrote:
> Hi List,
>
> I have some functional tests based on TestNG, the dir structure looks 
> like:
> ==========
> a1/b1/Test1.java
> a2/b2/Test2.java
> a3/b3/Test3.java
> ==========
>
> For Test1.java and Test2.java, they are located in "a1.b1" or "a2.b2" 
> package really.
> But for Test3.java, it is in default package. Here a3/b3 is only 
> simple source directory.
>
> As you know, we can use TEST.properties to declare source root like below:
> =======
> //it can be referenced to Test1 and Test2. Fail to get Test3.
> TestNG.dirs = .
> =======
> or
> =======
> //it can be referenced to Test3. Fail to get Test1 and Test2.
> TestNG.dirs = a3/b3
> =======
>
> My question is how I can reference to Test1, Test2 and Test3 at same 
> time? It looks "TestNG.dirs = .;a3/b3" or "TestNG.dirs = . a3/b3" does 
> not work.
>
> FYI,
> For some reason I want to keep all structure hierarchy. And I do not 
> want to move Test.java into a3.b3 package. Could it be resolved 
> through TEST.properties directly?
>
> Regards
> Patrick

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/jtreg-use/attachments/20131018/c2e8aa49/attachment.html 


More information about the jtreg-use mailing list