The immediate issues I am aiming to resolve is the ability to tag and execute specific tests, report tests as being 'not run' (rather than passed/failed) and get some cool xml reporting going on. From a skim through of the TestNG stuff it looks like that's going to make my life easier.
So, what to do.
Using TestNG in your code (for Java)
Get TestNG jar
1) download TestNG (http://testng.org/doc/download.html)
2) save/extract somewhere
In your project/build tool
3) configure your project's build path to include the TestNG Jar
In your code
4) Remove your JUnit references, just to force us in to importing/using TestNG's stuff
//import org.junit.*;
5) Add in references to TestNG
import org.testng.annotations.Test;
import org.testng.Assert;
6) replace your JUnit assert(..., ...) commands with Assert.assert(..., ...)
Please note, TestNG goes
Assert.assertEquals(actual, expected)
rather than expected, actual.
Driving TestNG with eclipse
Get Eclipse/TestNG plugin (offline download)
Well, I need to try something like this (http://stackoverflow.com/questions/5155786/how-to-install-testng-eclipse-plugin-offline)
And the link to download the plugin (not necessarily the most up to date, but at least a working one) is here: https://groups.google.com/forum/?fromgroups=#!topic/testng-users/v8mlca9oQoo
With this I have simply placed the .jar in my eclipse plug in dir (e.g. C:\dev\eclipse\plugins) and the started Eclipse, and I seem to have gained the ability to run TestNG tests.
And now the TestNG plug in / program runner is available within the Debug As and Run As context menu options.
Alternative / Eclipse's easy as 'Install' feature
You can do this cool thing where you download and install the software by going Help > Install new Software > and then chose TestNG from http://beust.com/eclipse
I work under archaic, fear based corporate policies however, and so this option is not available to me.
No comments:
Post a Comment