Recently, TestNG produced a new release, 5.12. This release is now in the central repository, though under the version 5.12.1 (more on that below).
Upgrading to 5.12.1
If you’ve been using TestNG with Maven, or are familiar with the changes in TestNG 5.12, you’ll notice there is a difference in this version to previous releases. There is no longer a jdk14 and jdk15 variant of the JAR – with the JDK 1.4 javadoc-style annotations no longer supported, there is just the single TestNG JAR. This means that previous versions using ranges will not automatically upgrade, which is expected given the compatibility change.
Where you might previously have had this in your POM:
<dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>5.11</version> <classifier>jdk15</classifier> <scope>test</scope> </dependency>
You can now simply use this:
<dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>5.12.1</version> <scope>test</scope> </dependency>
No other changes should be necessary.
Guice users should be aware that TestNG now depends on Guice 2.0, and bundles the classes in the JAR. Consequently, Guice is listed as a provided dependency – I haven’t noticed this causing any conflict as long as you are using the official Guice 1.0 or 2.0 release, but this is something to look out for in the future.
Getting TestNG to Central
Some will wonder why this still took so long, given the TestNG release was about a month ago.
Firstly, the library had added a dependency on Guice, and removed a dependency on QDox. This required updates to the POM that were not present in the released bundle. As an Ant-built project, the TestNG POM needs to be maintained separately.
Secondly, Cedric very patiently obliged with several requirements to make it easier for Maven releases in future – in particular, the bundle now includes GPG signatures.
Finally, it turned out that there had been a problem in producing the original distribution, leading to a discrepancy between the Maven release and the original release. This is the reason that there is now a version 5.12.1 (which will likewise be on testng.org shortly) that corrects the content and aligns the TestNG distribution with the Maven release of the same JAR.
The upshot of all of this is that, while this required some back-and-forth to get everything right, future releases will now be much quicker to process and the potential is there for further automation.
Are you Using TestNG with Maven?
I’ve been using TestNG with Maven for some time now, finding it particularly powerful for handling functional testing with Selenium. If you’re using TestNG with Maven, what do you think of the current support?