9

Currently, I am using TestNG 6.8 with Maven, but when I run the test through the IntelliJ IDEA plugin, it uses an old version of TestNG.

How can I make IntelliJ IDEA (version 11.1.4) work with TestNG 6.8?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user1835346
  • 111
  • 1
  • 2
  • 4

2 Answers2

8
  1. Download the complete TestNG 6.8 zip.
  2. Delete IDEA\plugins\testng\lib\testng-jdk15.jar.
  3. Copy testng-6.8.jar from the downloaded zip into IDEA\plugins\testng\lib.

For IDEA 12+: replace testng.jar instead of testng-jdk15.jar.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • thanks a lot, it worked even that i did the same before(did not work) :) – user1835346 Nov 19 '12 at 11:41
  • @CrazyCoder. In the lib folder there are 2 jars: testng.jar, testng-jdk15.jar. Which one should We replace with new testng version? Seems testng-jdk15.jar is different from testng.jar. BUT when i replace testng.jar to new one all run test menu(mouse right click) are gone. Plugin stopped working, Any ideas? – Elbek Dec 26 '12 at 20:08
  • 1
    @elbek, replace `testng-jdk15.jar`, `testng.jar` is the integration plug-in itself and must remain there (the name is changed to 'testng-plugin.jar' in IDEA 12 to avoid this kind of confusion and if you are using IDEA 12 or later, `testng.jar` needs to be replaced instead). – CrazyCoder Dec 27 '12 at 05:57
  • I upgraded but it stopped working. testng-jdk15 size is 1.2Mb. lates version of testng is 600-700KB, how come it may work. I opened testng-jdk15 and it contains junit and other tools. After upgrade when i run test against a method it is telling no test suite. Thanks for answer – Elbek Dec 27 '12 at 15:04
  • @elbek, you are using the wrong jar, please use the one from the link in my answer. The one from Maven is not complete! – CrazyCoder Dec 27 '12 at 15:35
  • @CrazyCoder Update worked, I did not know that it was incomplete. However i am having this issue: http://devnet.jetbrains.net/thread/440721 still – Elbek Dec 27 '12 at 15:53
  • It's already spelled out in the answer, but it's worth reiterating here that when you copy the new `testng-6.8.jar` into the plugins directory, you do not need to rename it to match the file you deleted (I did that first, and it obviously did not work). – Thomas Kelley Jun 30 '13 at 00:07
1

Here's a better way: In "Project Structure" -> "Modules" -> "Dependencies", click the left bottom "+" to add a new dependency from either pre-downloaded jar file, or library from Maven repository. Remember to remove the old TestNG version, or move the new version to above that.

jhtfl
  • 11
  • 3