Using TestNG asserts in a non-TestNG test

Alex Schenkman alex.schenkman at
Tue May 14 01:03:42 PDT 2013

Thanks for your answer Jonathan!

Is there any drawback to adding TestNG.jar to the path?
Rewriting asserts, and potentially other constructs, that exists already 
in TestNG seems unnecessary.

If JTREG has already decided on TestNG why not use it?

On 2013-05-06 16:59, Jonathan Gibbons wrote:
> Right now, you can't.   testng.jar is only added to the classpath if 
> it is a TestNG test.
> If you are looking to avoid complexity, I would avoid the use of 
> TestNG altogether and just declare the necessary assert methods in 
> your test.
> -- Jon
> On 05/06/2013 04:05 AM, Alex Schenkman wrote:
>> Hi list,
>> I have a test that should run with a few VM options and thus I've 
>> been running it as:
>> @ run main/othervm -DmyOptions MyTest
>> I'd like to use the asserts found in TestNG, so I add the import:
>> import static org.testng.Assert.*;
>> The compile phase complains about not finding org.testng.
>> If I run it like this, the import is found:
>> @ run testng MyTest
>> But this is not really what I want, as it adds another complexity 
>> layer to the test, namely the TestNG framework.
>> So the question is:
>> How can I reference the (bundled) jtreg/lib/testng.jar?
>> Thanks in advance!
>> -- 
>> Alex Schenkman
>> Java VM SQE Stockholm

Alex Schenkman
Java VM SQE Stockholm

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the jtreg-use mailing list