Using TestNG asserts in a non-TestNG test

Jonathan Gibbons jonathan.gibbons at oracle.com
Mon May 6 07:59:14 PDT 2013


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

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


More information about the jtreg-use mailing list