Hello,
I recently tried to switch a project from JUnit to TestNG, unfortunately my Tests all broke in a pecular way. Namely they through ParameterExceptions when they didn't before. Upon closer inspection it appears that the TestNG / Eclipse plugin loads it's own internal version of JCommander up and then uses that. This causes my own build of JCommander, which has some additional support for things not yet in JCommander to break horribly.
System.out.println("Location:" + this.getClass().getClassLoader().getResource("com/beust/jcommander/JCommander.class"));
in TestNG to say:
Location:jar:file:/opt/eclipse/plugins/org.testng.eclipse_6.7.0.20120825_1316/lib/testng.jar!/com/beust/jcommander/JCommander.class
In JUnit it says:
Location:jar:file:/home/sjr/git/AutomaticConfiguratorLibrary/lib/jcommander.jar!/com/beust/jcommander/JCommander.class
Thoughts:
Will this work in general? Specifically the class path in question I think is just the runtime class path, so if I want to use TestNG in general where I don't have JCommander it seems like it would be unavailable.
I'm also not sure about how to just replace this, should I just go into the eclipse installation and replace testng.jar with the downloadable one, and find the dependencies somehow (I assume Maven will tell me but I'm not a maven user).
I suppose another option would be to just replace the class files in my plugin with my version, but that might also be brittle.
Steve Ramage
In the TestNG settings, there is a check box "Use the projects testng.jar", no need to modify the installation.
What is the bare bones version of testNG, I downloaded the zip off the website, but it also includes jcommander internally.
Try the one in Maven central:
http://search.maven.org/#artifactdetails%7Corg.testng%7Ctestng%7C6.8%7Cjar
Hmmmm that seems to have worked, there were no other dependencies, it seems to work as is thank you.
Good to hear. Note that you might encounter ClassNotFoundExceptions when you start running tests that exercise different code paths in TestNG, but you know what to do then...